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:BgIgCAISBgoECAgICBIDCgEBEgMKAQESABIDCgEIEgMKAQhWAAJNNgDAhD0AAk04AIDC1y8ACE1JTExJT042AICA6YOx3hYADk1BUktFVElOR1NIQVJFAKCNBgAJVEVBTVNIQVJFAMCaDAANQUNUSVZJVFlTSEFSRQCgjQYAC1BMQVlFUlNIQVJFAIC1GAAKWUVBUk1JTExJUwCAhuvHdQAKV0VFS01JTExJUwCAiLKgAgAJTUFYUEVSSU9EAJwBABBtYXJrZXRpbmdBZGRyS2V5Ag1tYXJrZXRpbmdBZGRyAAt0ZWFtQWRkcktleQIIdGVhbUFkZHIAFGxhc3RNYXJrZXRpbmdUaW1lS2V5AhlsYXN0Q2xhaW1lZFRpbWVfbWFya2V0aW5nABZtYXJrZXRpbmdBbW91bnRMZWZ0S2V5AhNtYXJrZXRpbmdBbW91bnRMZWZ0AA9sYXN0VGVhbVRpbWVLZXkCFGxhc3RDbGFpbWVkVGltZV90ZWFtABF0ZWFtQW1vdW50TGVmdEtleQIOdGVhbUFtb3VudExlZnQAFWxhc3RBY3Rpdml0aWVzVGltZUtleQIabGFzdENsYWltZ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TdGFrZUxhbmQBBGFkZHIDCQECIT0CCAUBaQZjYWxsZXIFD3N0YWtpbmdDb250cmFjdAkAAgECEVBlcm1pc3Npb24gZGVuaWVkCQENY2xhaW1JbnRlcm5hbAEFBGFkZHIBaQENb25VbnN0YWtlTGFuZAEEYWRkcgMJAQIhPQIIBQFpBmNhbGxlcgUPc3Rha2luZ0NvbnRyYWN0CQACAQIRUGVybWlzc2lvbiBkZW5pZWQJAQ1jbGFpbUludGVybmFsAQUEYWRkcgDSiy1o", "height": 2663069, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: E8mQtK1Sc1f4youKgYMjFT11XtZAxrPAT7V6NSeMedBB Next: 5vdMdrLaydDAXtH1w46nY4fXVT2YEDTy9mHqe8EqKWpX Diff:
OldNewDifferences
5151 let idxWlgPrice = 1
5252
5353 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
5474
5575 let dappRest = 0
5676
112132 let lastActivitiesTime = valueOrElse(getInteger(contracts[dappRest], lastActivitiesTimeKey), issueTime)
113133 let actAmountAvailableNow = min([fraction(actTotal, (now - lastActivitiesTime), (3 * YEARMILLIS)), actAmountLeft])
114134 let actWlgold = assetBalance(contracts[dappRest], wlgId)
135+ let lastUserTime = valueOrElse(getInteger(contracts[dappWlg], keyLastClaimedTimeByUser(userAddrOpt)), issueTime)
136+ let lastUserPeriod = ((lastUserTime - issueTime) / WEEKMILLIS)
115137 let curPeriod = ((now - issueTime) / WEEKMILLIS)
138+ let period = min([(lastUserPeriod + 1), curPeriod])
116139 let eff = getPieces(userAddrOpt, contracts[dappStaking])
117140 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))))
121143 let userAmount = fraction(fraction(curPeriodDistribution, eff[1], totalPieces), (now - lastUserTime), (3 * YEARMILLIS))
122144 [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]
123145 }
126148 func keyBlocked () = "contractsBlocked"
127149
128150
129-let KSALLOWWLGOLD = false
151+let KSALLOWWLGOLD = true
130152
131153 let chain = take(drop(this.bytes, 1), 1)
132154
162184 let MULT6 = 1000000
163185
164186 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
175187
176188 let MINSHOPPAYMENT = 100000
177189
214226
215227 let puzzlePoolContract = getContractAddressOrFail(restCfg, IdxCfgPuzzlePoolDapp)
216228
217-let recLandSize = 1
218-
219229 let wlgAssetIdKey = "wlg_assetId"
220230
221231 let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet")
222-
223-let IdxEffTotal = 0
224232
225233 let IdxEffUser = 1
226234
227235 func keyResProportions () = "resTypesProportions"
228236
229237
230-func keyStakedLandsByOwner (ownerAddr) = ("stakedLandsByOwner_" + ownerAddr)
238+func keyStakedPiecesByOwner (ownerAddr) = ("stakedPiecesByOwner_" + ownerAddr)
231239
232240
233241 func asInt (v) = match v {
235243 n
236244 case _ =>
237245 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")
254246 }
255247
256248
272264
273265 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
274266 }
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)
301268 [totalPower, usersPower]
302269 }
303270
344311 then $Tuple2(nil, 0)
345312 else {
346313 let caller = addressFromStringValue(addr)
314+ let curStats = getWlgStats(addr, [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract], usdtAssetId)
347315 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)))
365325 then throw("Please modify contract for next 1.5 years, according to stats")
366326 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]
374329 let userKey = keyStakersAmountPaidUser(addr)
375- $Tuple2([ScriptTransfer(marketingAddr, marketingAmount, wlgAssetId), ScriptTransfer(teamAddr, teamAmount, wlgAssetId), ScriptTransfer(restContract, actAmount, wlgAssetId), ScriptTransfer(caller, userAmount, wlgAssetId), IntegerEntry(userKey, (valueOrElse(getInteger(userKey), 0) + userAmount)), IntegerEntry(stakersAmountPaidTotalKey, (valueOrElse(getInteger(stakersAmountPaidTotalKey), 0) + userAmount)), IntegerEntry(stakersAmountLeftKey, (amountLeftTotal - userAmount)), IntegerEntry(marketingAmountLeftKey, (marketingAmountLeft - marketingAmount)), IntegerEntry(lastMarketingTimeKey, now), IntegerEntry(teamAmountLeftKey, (teamAmountLeft - teamAmount)), IntegerEntry(lastTeamTimeKey, now), IntegerEntry(actAmountLeftKey, (actAmountLeft - actAmount)), IntegerEntry(lastActivitiesTimeKey, now), IntegerEntry(userTimeKey, now)], userAmount)
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)
376331 }
377332 }
378333
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 WEEKMILLIS = 604800000
2121
2222 let MAXPERIOD = 156
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 let wlgIssueTimeKey = "wlg_issueTime"
4646
4747 let wlgIssuedAmountKey = "wlg_issuedAmount"
4848
4949 let idxWlgAmount = 0
5050
5151 let idxWlgPrice = 1
5252
5353 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
5474
5575 let dappRest = 0
5676
5777 let dappStaking = 1
5878
5979 let dappEconomy = 2
6080
6181 let dappWlg = 4
6282
6383 let dappPuzzle = 5
6484
6585 func getPieces (userAddrStrOrEmpty,stakingContract) = {
6686 let props = split(valueOrElse(getString(stakingContract, "resTypesProportions"), "0_0_0_0_0_0"), "_")
6787 func adder (acc,item) = (acc + parseIntValue(item))
6888
6989 let totalPower = {
7090 let $l = props
7191 let $s = size($l)
7292 let $acc0 = 0
7393 func $f0_1 ($a,$i) = if (($i >= $s))
7494 then $a
7595 else adder($a, $l[$i])
7696
7797 func $f0_2 ($a,$i) = if (($i >= $s))
7898 then $a
7999 else throw("List size exceeds 6")
80100
81101 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
82102 }
83103 let usersPower = valueOrElse(getInteger(stakingContract, ("stakedPiecesByOwner_" + userAddrStrOrEmpty)), 0)
84104 [totalPower, usersPower]
85105 }
86106
87107
88108 func getWlgStats (userAddrOpt,contracts,usdtId) = {
89109 let issuedAmount = valueOrErrorMessage(getInteger(contracts[dappWlg], wlgIssuedAmountKey), "WLGOLD is not issued yet")
90110 let economyUsd = assetBalance(contracts[dappEconomy], usdtId)
91111 let restUsd = assetBalance(contracts[dappRest], usdtId)
92112 let wlgUsd = assetBalance(contracts[dappWlg], usdtId)
93113 let puzzleUsd = assetBalance(contracts[dappPuzzle], usdtId)
94114 let totalFundsUsd = ((economyUsd + restUsd) + wlgUsd)
95115 let wlgId = valueOrErrorMessage(getBinary(contracts[dappWlg], "wlg_assetId"), "Not initialized yet")
96116 let now = lastBlock.timestamp
97117 let issueTime = valueOrErrorMessage(getInteger(contracts[dappWlg], wlgIssueTimeKey), "Not initialized")
98118 let marketingTotal = fraction(MILLION6, MARKETINGSHARE, M6)
99119 let marketingAmountLeft = valueOrElse(getInteger(contracts[dappWlg], marketingAmountLeftKey), marketingTotal)
100120 let lastMarketingTime = valueOrElse(getInteger(contracts[dappWlg], lastMarketingTimeKey), issueTime)
101121 let marketingAddr = addressFromStringValue(value(getString(contracts[dappWlg], marketingAddrKey)))
102122 let marketingAmountAvailableNow = min([fraction(marketingTotal, (now - lastMarketingTime), YEARMILLIS), marketingAmountLeft])
103123 let marketingWlgold = assetBalance(marketingAddr, wlgId)
104124 let teamTotal = fraction(MILLION6, TEAMSHARE, M6)
105125 let teamAmountLeft = valueOrElse(getInteger(contracts[dappWlg], teamAmountLeftKey), teamTotal)
106126 let lastTeamTime = valueOrElse(getInteger(contracts[dappWlg], lastTeamTimeKey), issueTime)
107127 let teamAddr = addressFromStringValue(value(getString(contracts[dappWlg], teamAddrKey)))
108128 let teamAmountAvailableNow = min([fraction(teamTotal, (now - lastTeamTime), (3 * YEARMILLIS)), teamAmountLeft])
109129 let teamWlgold = assetBalance(teamAddr, wlgId)
110130 let actTotal = fraction(MILLION6, ACTIVITYSHARE, M6)
111131 let actAmountLeft = valueOrElse(getInteger(contracts[dappRest], actAmountLeftKey), actTotal)
112132 let lastActivitiesTime = valueOrElse(getInteger(contracts[dappRest], lastActivitiesTimeKey), issueTime)
113133 let actAmountAvailableNow = min([fraction(actTotal, (now - lastActivitiesTime), (3 * YEARMILLIS)), actAmountLeft])
114134 let actWlgold = assetBalance(contracts[dappRest], wlgId)
135+ let lastUserTime = valueOrElse(getInteger(contracts[dappWlg], keyLastClaimedTimeByUser(userAddrOpt)), issueTime)
136+ let lastUserPeriod = ((lastUserTime - issueTime) / WEEKMILLIS)
115137 let curPeriod = ((now - issueTime) / WEEKMILLIS)
138+ let period = min([(lastUserPeriod + 1), curPeriod])
116139 let eff = getPieces(userAddrOpt, contracts[dappStaking])
117140 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))))
121143 let userAmount = fraction(fraction(curPeriodDistribution, eff[1], totalPieces), (now - lastUserTime), (3 * YEARMILLIS))
122144 [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]
123145 }
124146
125147
126148 func keyBlocked () = "contractsBlocked"
127149
128150
129-let KSALLOWWLGOLD = false
151+let KSALLOWWLGOLD = true
130152
131153 let chain = take(drop(this.bytes, 1), 1)
132154
133155 let usdtAssetId = match chain {
134156 case _ =>
135157 if ((base58'2W' == $match0))
136158 then base58'9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi'
137159 else if ((base58'2T' == $match0))
138160 then base58'6mWwf9mZBjVgkC54idpyaZLQfAosD914wT8fGf2iiY63'
139161 else throw("Unknown chain")
140162 }
141163
142164 let defaultRestAddressStr = match chain {
143165 case _ =>
144166 if ((base58'2W' == $match0))
145167 then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv"
146168 else if ((base58'2T' == $match0))
147169 then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy"
148170 else throw("Unknown chain")
149171 }
150172
151173 let arbitrageDelay = match chain {
152174 case _ =>
153175 if ((base58'2W' == $match0))
154176 then 600000
155177 else if ((base58'2T' == $match0))
156178 then 60000
157179 else throw("Unknown chain")
158180 }
159181
160182 let SEP = "__"
161183
162184 let MULT6 = 1000000
163185
164186 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
175187
176188 let MINSHOPPAYMENT = 100000
177189
178190 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
179191
180192
181193 let IdxCfgStakingDapp = 1
182194
183195 let IdxCfgEconomyDapp = 2
184196
185197 let IdxCfgGovernanceDapp = 3
186198
187199 let IdxCfgWlgDapp = 4
188200
189201 let IdxCfgPuzzlePoolDapp = 5
190202
191203 func keyRestCfg () = "%s__restConfig"
192204
193205
194206 func keyRestAddress () = "%s__restAddr"
195207
196208
197209 func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP)
198210
199211
200212 func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx)))
201213
202214
203215 let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr))
204216
205217 let restCfg = readRestCfgOrFail(restContract)
206218
207219 let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp)
208220
209221 let economyContract = getContractAddressOrFail(restCfg, IdxCfgEconomyDapp)
210222
211223 let govContract = getContractAddressOrFail(restCfg, IdxCfgGovernanceDapp)
212224
213225 let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp)
214226
215227 let puzzlePoolContract = getContractAddressOrFail(restCfg, IdxCfgPuzzlePoolDapp)
216228
217-let recLandSize = 1
218-
219229 let wlgAssetIdKey = "wlg_assetId"
220230
221231 let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet")
222-
223-let IdxEffTotal = 0
224232
225233 let IdxEffUser = 1
226234
227235 func keyResProportions () = "resTypesProportions"
228236
229237
230-func keyStakedLandsByOwner (ownerAddr) = ("stakedLandsByOwner_" + ownerAddr)
238+func keyStakedPiecesByOwner (ownerAddr) = ("stakedPiecesByOwner_" + ownerAddr)
231239
232240
233241 func asInt (v) = match v {
234242 case n: Int =>
235243 n
236244 case _ =>
237245 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")
254246 }
255247
256248
257249 func getVotingPower (userAddrStrOrEmpty) = {
258250 let props = split(valueOrElse(getString(stakingContract, keyResProportions()), "0_0_0_0_0_0"), "_")
259251 func adder (acc,item) = (acc + parseIntValue(item))
260252
261253 let totalPower = {
262254 let $l = props
263255 let $s = size($l)
264256 let $acc0 = 0
265257 func $f0_1 ($a,$i) = if (($i >= $s))
266258 then $a
267259 else adder($a, $l[$i])
268260
269261 func $f0_2 ($a,$i) = if (($i >= $s))
270262 then $a
271263 else throw("List size exceeds 6")
272264
273265 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
274266 }
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)
301268 [totalPower, usersPower]
302269 }
303270
304271
305272 func fixedPoint (val,decimals) = {
306273 let tenPow = pow(10, 0, decimals, 0, 0, DOWN)
307274 ((toString((val / tenPow)) + ".") + toString((val % tenPow)))
308275 }
309276
310277
311278 let A6 = 100000000
312279
313280 let B8 = 50000000
314281
315282 let profitAddrKey = "profitAddr"
316283
317284 func keyLastArbTimeByUser (addr) = ("lastArbTimeUser_" + addr)
318285
319286
320287 let stakersAmountPaidTotalKey = "stakersAmountPaidTotal"
321288
322289 func keyStakersAmountPaidUser (addr) = ("stakersAmountPaidUser_" + addr)
323290
324291
325292 func prolog () = if (valueOrElse(getBoolean(stakingContract, keyBlocked()), false))
326293 then throw("Contracts are under maintenance")
327294 else asInt(invoke(stakingContract, "saveLastTx", nil, nil))
328295
329296
330297 func getSwapLimit (addr) = {
331298 let lastTime = valueOrElse(getInteger(keyLastArbTimeByUser(addr)), 0)
332299 let now = lastBlock.timestamp
333300 if ((arbitrageDelay > (now - lastTime)))
334301 then throw((("Arbitrages are possible once a " + toString((arbitrageDelay / 60000))) + "min"))
335302 else {
336303 let pieces = getVotingPower(addr)[IdxEffUser]
337304 let pow8 = pow(pieces, 0, B8, 8, 8, CEILING)
338305 fraction(A6, pow8, MULT8)
339306 }
340307 }
341308
342309
343310 func claimInternal (addr) = if (!(KSALLOWWLGOLD))
344311 then $Tuple2(nil, 0)
345312 else {
346313 let caller = addressFromStringValue(addr)
314+ let curStats = getWlgStats(addr, [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract], usdtAssetId)
347315 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)))
365325 then throw("Please modify contract for next 1.5 years, according to stats")
366326 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]
374329 let userKey = keyStakersAmountPaidUser(addr)
375- $Tuple2([ScriptTransfer(marketingAddr, marketingAmount, wlgAssetId), ScriptTransfer(teamAddr, teamAmount, wlgAssetId), ScriptTransfer(restContract, actAmount, wlgAssetId), ScriptTransfer(caller, userAmount, wlgAssetId), IntegerEntry(userKey, (valueOrElse(getInteger(userKey), 0) + userAmount)), IntegerEntry(stakersAmountPaidTotalKey, (valueOrElse(getInteger(stakersAmountPaidTotalKey), 0) + userAmount)), IntegerEntry(stakersAmountLeftKey, (amountLeftTotal - userAmount)), IntegerEntry(marketingAmountLeftKey, (marketingAmountLeft - marketingAmount)), IntegerEntry(lastMarketingTimeKey, now), IntegerEntry(teamAmountLeftKey, (teamAmountLeft - teamAmount)), IntegerEntry(lastTeamTimeKey, now), IntegerEntry(actAmountLeftKey, (actAmountLeft - actAmount)), IntegerEntry(lastActivitiesTimeKey, now), IntegerEntry(userTimeKey, now)], userAmount)
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)
376331 }
377332 }
378333
379334
380335 @Callable(i)
381336 func constructorV1 (restAddr,marketingAddr,teamAddr,profitAddr) = if ((i.caller != this))
382337 then throw("Permission denied")
383338 else if (isDefined(getBinary(wlgAssetIdKey)))
384339 then throw("Already initialized")
385340 else {
386341 let issuedAmount = MILLION6
387342 let issue = Issue("WLGOLD", "WavesLands Gold investment token", issuedAmount, 8, true, unit, 0)
388343 let assetId = calculateAssetId(issue)
389344 [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)]
390345 }
391346
392347
393348
394349 @Callable(i)
395350 func buyWlg (minAmount) = if (!(KSALLOWWLGOLD))
396351 then $Tuple2(nil, 0)
397352 else {
398353 let prologResult = prolog()
399354 if ((size(i.payments) != 1))
400355 then throw("exactly 1 payment must be attached")
401356 else {
402357 let pmt = i.payments[0]
403358 let usdtAmt = pmt.amount
404359 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment")
405360 if ((pmtAssetId != usdtAssetId))
406361 then throw("USDT payments only!")
407362 else {
408363 let caller = i.caller
409364 let addr = toString(caller)
410365 let maxUsdt = getSwapLimit(addr)
411366 if ((usdtAmt > maxUsdt))
412367 then throw((("You can spend max " + fixedPoint(maxUsdt, 6)) + " USDT"))
413368 else if ((MINSHOPPAYMENT > usdtAmt))
414369 then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT"))
415370 else {
416371 let curStats = getWlgStats("", [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract], usdtAssetId)
417372 let curWlgAmount = curStats[idxWlgAmount]
418373 let oldFundsUsd = (curStats[idxWlgFunds] - usdtAmt)
419374 let wlgPrice = fraction(oldFundsUsd, MULT8, curWlgAmount)
420375 let buyPrice = fraction(wlgPrice, 6, 5)
421376 let wlgAmount = fraction(usdtAmt, MULT8, buyPrice)
422377 if ((minAmount > wlgAmount))
423378 then throw("Price changed during operation, please try again")
424379 else {
425380 let profitAmount = (usdtAmt / 6)
426381 let deltaFunds = (usdtAmt - profitAmount)
427382 let reissued = fraction(curWlgAmount, deltaFunds, oldFundsUsd)
428383 $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)
429384 }
430385 }
431386 }
432387 }
433388 }
434389
435390
436391
437392 @Callable(i)
438393 func sellWlg (minAmount) = if (!(KSALLOWWLGOLD))
439394 then $Tuple2(nil, 0)
440395 else {
441396 let prologResult = prolog()
442397 if ((size(i.payments) != 1))
443398 then throw("exactly 1 payment must be attached")
444399 else {
445400 let pmt = i.payments[0]
446401 let wlgAmt = pmt.amount
447402 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment")
448403 if ((pmtAssetId != wlgAssetId))
449404 then throw("WLGOLD payments only!")
450405 else {
451406 let caller = i.caller
452407 let addr = toString(caller)
453408 let maxUsdt = getSwapLimit(addr)
454409 let curStats = getWlgStats("", [restContract, stakingContract, economyContract, govContract, wlgContract, puzzlePoolContract], usdtAssetId)
455410 let curWlgAmount = curStats[idxWlgAmount]
456411 let sellPrice = fraction(curStats[idxWlgPrice], 4, 5)
457412 let usdtAmt = fraction(wlgAmt, sellPrice, MULT8)
458413 if ((usdtAmt > maxUsdt))
459414 then throw((("You can get max " + fixedPoint(maxUsdt, 6)) + " USDT"))
460415 else if ((MINSHOPPAYMENT > usdtAmt))
461416 then throw((("You can trade min " + fixedPoint(MINSHOPPAYMENT, 6)) + " USDT"))
462417 else if ((minAmount > usdtAmt))
463418 then throw("Price changed during operation, please try again")
464419 else {
465420 let profitAmount = (usdtAmt / 4)
466421 let burned = fraction((usdtAmt + profitAmount), curWlgAmount, curStats[idxWlgFunds])
467422 $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)
468423 }
469424 }
470425 }
471426 }
472427
473428
474429
475430 @Callable(i)
476431 func claim () = {
477432 let prologResult = prolog()
478433 let actions = claimInternal(toString(i.caller))._1
479434 $Tuple2(actions, prologResult)
480435 }
481436
482437
483438
484439 @Callable(i)
485440 func onStakeLand (addr) = if ((i.caller != stakingContract))
486441 then throw("Permission denied")
487442 else claimInternal(addr)
488443
489444
490445
491446 @Callable(i)
492447 func onUnstakeLand (addr) = if ((i.caller != stakingContract))
493448 then throw("Permission denied")
494449 else claimInternal(addr)
495450
496451

github/deemru/w8io/026f985 
72.93 ms