tx · 5mLpGSjrJ9FY9CnVPpc53f3Rku6vtNeMtpswhY5LcNi6

3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy:  -0.02600000 Waves

2023.08.10 17:05 [2704587] smart account 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy > SELF 0.00000000 Waves

{ "type": 13, "id": "5mLpGSjrJ9FY9CnVPpc53f3Rku6vtNeMtpswhY5LcNi6", "fee": 2600000, "feeAssetId": null, "timestamp": 1691676359660, "version": 2, "chainId": 84, "sender": "3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy", "senderPublicKey": "9W33iCCNfmFxUbiC6XZcH5x7f6xfwC7Jb3BoExT5q2PV", "proofs": [ "Vam6b6qtBpzicpmBE69Y9fJD8nTtohCjNdzSeq5FfYUqApx8MXn8yPPWrB8KpAn3gcziXFJ9ohZeEPsftdhormz" ], "script": "base64:BgKTLggCEggKBggIAQEBCBIFCgMBCAISAwoBARIECgIICBIECgIICBIDCgEIEgMKAQgSAwoBCBIECgIIARIDCgEIEgASABIFCgMICAQSAwoBCBIDCgEIEgQKAggIEgQKAggIIgNTRVAiBlNDQUxFOCIFTVVMVDgiDlBPT0xXRUlHSFRNVUxUIhBjb250cmFjdEZpbGVuYW1lIgdTQ0FMRTE4IgZNVUxUMTgiCE1VTFQxOEJJIgtibG9ja3NJbkRheSINYmxvY2tzSW5Nb250aCIHd3JhcEVyciIDbXNnIgh0aHJvd0VyciIPZ2V0U3RyaW5nT3JGYWlsIgdhZGRyZXNzIgNrZXkiDGdldEludE9yWmVybyIPZ2V0SW50T3JEZWZhdWx0IgpkZWZhdWx0VmFsIgxnZXRJbnRPckZhaWwiA2FicyIDdmFsIg5lbnN1cmVQb3NpdGl2ZSIBdiIBbSIba2V5UmVmZXJyYWxzQ29udHJhY3RBZGRyZXNzIh5yZWZlcnJhbHNDb250cmFjdEFkZHJlc3NPckZhaWwiFmtleVJlZmVycmFsUHJvZ3JhbU5hbWUiGnJlZmVycmFsUHJ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HVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmZhCWJvZHlCeXRlcwkAkQMCCAUCZmEGcHJvb2ZzAAAFAmZjR06/lw==", "height": 2704587, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BuDxLbzfHhTAMMSWGSuqi2m4qws1eKhjxMyTAgAQGASA Next: J4yBN261bq3dkFdNev3X6agcLXU6hredbUo21P4Q1UL1 Diff:
OldNewDifferences
789789
790790
791791 @Callable(i)
792-func unlock (txIdStr,amount) = {
792+func unlock (txIdStr) = {
793793 let userAddress = i.caller
794794 let userAddressStr = toString(userAddress)
795795 let txId = fromBase58String(txIdStr)
806806 let wxWithdrawable = getWxWithdrawable(userAddress, if ((txIdStr == ""))
807807 then unit
808808 else txId)
809- if ((amount > wxWithdrawable))
810- then throwErr(("maximum amount to unlock: " + toString(wxWithdrawable)))
809+ let coeffX8 = fraction(lockDuration, MULT8, maxLockDuration)
810+ let gWxAmountStart = fraction(userAmount, coeffX8, MULT8)
811+ let gwxBurned = min([fraction((t * blocksInPeriod), gWxAmountStart, maxLockDuration), gwxAmount])
812+ let gwxRemaining = ensurePositive((gwxAmount - gwxBurned), "gwxRemaining")
813+ let lockedGwxAmount = getLockedGwxAmount(userAddress)
814+ if ((0 >= userAmount))
815+ then throwErr("nothing to unlock")
811816 else {
812- let coeffX8 = fraction(lockDuration, MULT8, maxLockDuration)
813- let gWxAmountStart = fraction(userAmount, coeffX8, MULT8)
814- let gwxBurned = fraction((t * blocksInPeriod), gWxAmountStart, maxLockDuration)
815- let gwxRemaining = ensurePositive((gwxAmount - gwxBurned), "gwxRemaining")
816- let lockedGwxAmount = getLockedGwxAmount(userAddress)
817- if ((0 >= userAmount))
818- then throwErr("nothing to unlock")
817+ let gwxAmountTotal = getGwxAmountTotal()
818+ let userGwxAmountTotal = getUserGwxAmountTotal(userAddress)
819+ let userGwxAmountTotalNew = ensurePositive((userGwxAmountTotal - gwxBurned), "userGwxAmountTotalNew")
820+ if ((lockedGwxAmount > userGwxAmountTotalNew))
821+ then throwErr(("locked gwx amount: " + toString(lockedGwxAmount)))
819822 else {
820- let gwxAmountTotal = getGwxAmountTotal()
821- let userGwxAmountTotal = getUserGwxAmountTotal(userAddress)
822- let userGwxAmountTotalNew = ensurePositive((userGwxAmountTotal - gwxBurned), "userGwxAmountTotalNew")
823- if ((lockedGwxAmount > userGwxAmountTotalNew))
824- then throwErr(("locked gwx amount: " + toString(lockedGwxAmount)))
825- else {
826- let gwxRewardInv = reentrantInvoke(gwxRewardContract, "refreshUserReward", [userAddress.bytes], nil)
827- if ((gwxRewardInv == gwxRewardInv))
828- then ((((LockParamsEntry(userAddress, txId, userAmount, lockStart, lockDuration, gwxRemaining, (wxClaimed + amount)) ++ StatsEntry(-(amount), 0, 0, 0)) :+ HistoryEntry("unlock", userAddressStr, amount, lockStart, lockDuration, gwxBurned, i)) :+ ScriptTransfer(userAddress, amount, assetId)) ++ [IntegerEntry(keyGwxTotal(), ensurePositive((gwxAmountTotal - gwxBurned), "gwxTotal")), IntegerEntry(keyUserGwxAmountTotal(userAddress), userGwxAmountTotalNew)])
829- else throw("Strict value is not equal to itself.")
830- }
823+ let gwxRewardInv = reentrantInvoke(gwxRewardContract, "refreshUserReward", [userAddress.bytes], nil)
824+ if ((gwxRewardInv == gwxRewardInv))
825+ then ((((LockParamsEntry(userAddress, txId, userAmount, lockStart, lockDuration, gwxRemaining, (wxClaimed + wxWithdrawable)) ++ StatsEntry(-(wxWithdrawable), 0, 0, 0)) :+ HistoryEntry("unlock", userAddressStr, wxWithdrawable, lockStart, lockDuration, gwxBurned, i)) :+ ScriptTransfer(userAddress, wxWithdrawable, assetId)) ++ [IntegerEntry(keyGwxTotal(), ensurePositive((gwxAmountTotal - gwxBurned), "gwxTotal")), IntegerEntry(keyUserGwxAmountTotal(userAddress), userGwxAmountTotalNew)])
826+ else throw("Strict value is not equal to itself.")
831827 }
832828 }
833829 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let SCALE8 = 8
77
88 let MULT8 = 100000000
99
1010 let POOLWEIGHTMULT = MULT8
1111
1212 let contractFilename = "boosting.ride"
1313
1414 let SCALE18 = 18
1515
1616 let MULT18 = 1000000000000000000
1717
1818 let MULT18BI = toBigInt(MULT18)
1919
2020 let blocksInDay = 1440
2121
2222 let blocksInMonth = 43800
2323
2424 func wrapErr (msg) = makeString([contractFilename, ": ", msg], "")
2525
2626
2727 func throwErr (msg) = throw(wrapErr(msg))
2828
2929
3030 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), wrapErr((("mandatory this." + key) + " is not defined")))
3131
3232
3333 func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0)
3434
3535
3636 func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal)
3737
3838
3939 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), wrapErr((("mandatory this." + key) + " is not defined")))
4040
4141
4242 func abs (val) = if ((0 > val))
4343 then -(val)
4444 else val
4545
4646
4747 func ensurePositive (v,m) = if ((v >= 0))
4848 then v
4949 else throwErr((valueOrElse(m, "value") + " should be positive"))
5050
5151
5252 func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP)
5353
5454
5555 let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(this, keyReferralsContractAddress()))
5656
5757 let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP)
5858
5959 let referralProgramNameDefault = "wxlock"
6060
6161 let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault)
6262
6363 func keyFactoryAddress () = "%s%s__config__factoryAddress"
6464
6565
6666 let IdxFactoryCfgStakingDapp = 1
6767
6868 let IdxFactoryCfgBoostingDapp = 2
6969
7070 let IdxFactoryCfgIdoDapp = 3
7171
7272 let IdxFactoryCfgTeamDapp = 4
7373
7474 let IdxFactoryCfgEmissionDapp = 5
7575
7676 let IdxFactoryCfgRestDapp = 6
7777
7878 let IdxFactoryCfgSlippageDapp = 7
7979
8080 let IdxFactoryCfgDaoDapp = 8
8181
8282 let IdxFactoryCfgMarketingDapp = 9
8383
8484 let IdxFactoryCfgGwxRewardDapp = 10
8585
8686 let IdxFactoryCfgBirdsDapp = 11
8787
8888 func keyFactoryCfg () = "%s__factoryConfig"
8989
9090
9191 func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
9292
9393
9494 func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
9595
9696
9797 func keyFactoryPoolWeightHistory (poolAddress,num) = ((("%s%s__poolWeight__" + poolAddress) + "__") + toString(num))
9898
9999
100100 func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress()))
101101
102102
103103 func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP)
104104
105105
106106 func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp])
107107
108108
109109 func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp])
110110
111111
112112 func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp])
113113
114114
115115 func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp])
116116
117117
118118 func keyManagerPublicKey () = "%s__managerPublicKey"
119119
120120
121121 func keyManagerVaultAddress () = "%s__managerVaultAddress"
122122
123123
124124 func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
125125
126126
127127 func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current"
128128
129129
130130 func keyEmissionStartBlock () = "%s%s__emission__startBlock"
131131
132132
133133 func keyBoostingV2LastUpdateHeight () = "%s%s__boostingV2__startBlock"
134134
135135
136136 func keyBoostingV2Integral () = "%s%s__boostingV2__integral"
137137
138138
139139 func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
140140
141141
142142 func keyEmissionEndBlock () = "%s%s__emission__endBlock"
143143
144144
145145 func keyNextPergetIntOrDefault () = "%s__nextPeriod"
146146
147147
148148 func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight"
149149
150150
151151 let IdxCfgAssetId = 1
152152
153153 let IdxCfgMinLockAmount = 2
154154
155155 let IdxCfgMinLockDuration = 3
156156
157157 let IdxCfgMaxLockDuration = 4
158158
159159 let IdxCfgMathContract = 5
160160
161161 let IdxCfgBlocksInPeriod = 6
162162
163163 func keyConfig () = "%s__config"
164164
165165
166166 func readConfigArrayOrFail () = split(getStringOrFail(this, keyConfig()), SEP)
167167
168168
169169 let cfgArray = readConfigArrayOrFail()
170170
171171 let assetId = fromBase58String(cfgArray[IdxCfgAssetId])
172172
173173 let minLockAmount = valueOrErrorMessage(parseInt(cfgArray[IdxCfgMinLockAmount]), wrapErr("invalid min lock amount"))
174174
175175 let minLockDuration = valueOrErrorMessage(parseInt(cfgArray[IdxCfgMinLockDuration]), wrapErr("invalid min lock duration"))
176176
177177 let maxLockDuration = valueOrErrorMessage(parseInt(cfgArray[IdxCfgMaxLockDuration]), wrapErr("invalid max lock duration"))
178178
179179 let mathContract = valueOrErrorMessage(addressFromString(cfgArray[IdxCfgMathContract]), wrapErr("invalid math contract address"))
180180
181181 let blocksInPeriod = valueOrErrorMessage(parseInt(cfgArray[IdxCfgBlocksInPeriod]), wrapErr("invalid blocks in period"))
182182
183183 func formatConfigS (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = makeString(["%s%d%d%d%s", assetId, minLockAmount, minLockDuration, maxLockDuration, mathContract], SEP)
184184
185185
186186 func formatConfig (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = formatConfigS(assetId, toString(minLockAmount), toString(minLockDuration), toString(maxLockDuration), mathContract)
187187
188188
189189 func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) {
190190 case s: String =>
191191 addressFromStringValue(s)
192192 case _ =>
193193 this
194194 }
195195
196196
197197 func managerPublicKeyOrUnit () = {
198198 let managerVaultAddress = getManagerVaultAddressOrThis()
199199 match getString(managerVaultAddress, keyManagerPublicKey()) {
200200 case s: String =>
201201 fromBase58String(s)
202202 case _: Unit =>
203203 unit
204204 case _ =>
205205 throw("Match error")
206206 }
207207 }
208208
209209
210210 func mustManager (i) = {
211211 let pd = throwErr("Permission denied")
212212 match managerPublicKeyOrUnit() {
213213 case pk: ByteVector =>
214214 if ((i.callerPublicKey == pk))
215215 then true
216216 else pd
217217 case _: Unit =>
218218 if ((i.caller == this))
219219 then true
220220 else pd
221221 case _ =>
222222 throw("Match error")
223223 }
224224 }
225225
226226
227227 let IdxLockAmount = 1
228228
229229 let IdxLockStart = 2
230230
231231 let IdxLockDuration = 3
232232
233233 let IdxLockLastUpdateTimestamp = 4
234234
235235 let IdxLockGwxAmount = 5
236236
237237 let IdxLockWxClaimed = 6
238238
239239 func keyLockParamsRecord (userAddress,txId) = makeString(["%s%s%s__lock", toString(userAddress), match txId {
240240 case b: ByteVector =>
241241 toBase58String(b)
242242 case _: Unit =>
243243 "legacy"
244244 case _ =>
245245 throw("Match error")
246246 }], SEP)
247247
248248
249249 func readLockParamsRecordOrFail (userAddress,txId) = split(getStringOrFail(this, keyLockParamsRecord(userAddress, txId)), SEP)
250250
251251
252252 func keyUserGwxAmountTotal (userAddress) = makeString(["%s%s__gwxAmountTotal", toString(userAddress)], SEP)
253253
254254
255255 func formatLockParamsRecord (amount,start,duration,gwxAmount,wxClaimed) = makeString(["%d%d%d%d%d%d%d", toString(amount), toString(start), toString(duration), toString(lastBlock.timestamp), toString(gwxAmount), toString(wxClaimed)], SEP)
256256
257257
258258 func keyNextUserNum () = "%s__nextUserNum"
259259
260260
261261 func keyUser2NumMapping (userAddress) = makeString(["%s%s%s__mapping__user2num", userAddress], SEP)
262262
263263
264264 func keyNum2UserMapping (num) = makeString(["%s%s%s__mapping__num2user", num], SEP)
265265
266266
267267 func keyLockParamTotalAmount () = "%s%s__stats__activeTotalLocked"
268268
269269
270270 func keyStatsLocksDurationSumInBlocks () = "%s%s__stats__locksDurationSumInBlocks"
271271
272272
273273 func keyStatsLocksCount () = "%s%s__stats__locksCount"
274274
275275
276276 func keyStatsUsersCount () = "%s%s__stats__activeUsersCount"
277277
278278
279279 func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastIntV2", toString(userNum)], SEP)
280280
281281
282282 func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastIntV2", toString(userNum), lpAssetId], SEP)
283283
284284
285285 func keyUserMaxBoostINTEGRAL (userNum) = makeString(["%s%d__maxBoostInt", toString(userNum)], SEP)
286286
287287
288288 func keyTotalMaxBoostINTEGRAL () = "%s%s__maxBoostInt__total"
289289
290290
291291 func keyUserBoostAvalaibleToClaimTotal (userNum) = makeString(["%s%d__userBoostAvaliableToClaimTotal", toString(userNum)], SEP)
292292
293293
294294 func keyUserBoostClaimed (userNum) = makeString(["%s%d__userBoostClaimed", toString(userNum)], SEP)
295295
296296
297297 func keyGwxTotal () = "%s%s__gwx__total"
298298
299299
300300 func keyVote (amountAssetId,priceAssetId,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP)
301301
302302
303303 func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP)
304304
305305
306306 func keyCurrentEpochUi () = makeString(["%s", "currentEpochUi"], SEP)
307307
308308
309309 func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], SEP)
310310
311311
312312 func keyVotingResultStakedIntegral (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegral", lpAssetIdStr, toString(epoch)], SEP)
313313
314314
315315 func keyVotingResultStakedLastUpdateHeight (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(epoch)], SEP)
316316
317317
318318 func keyVotingResultStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "votingResultStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
319319
320320
321321 func keyVoteStakedIntegral (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegral", lpAssetIdStr, toString(address), toString(epoch)], SEP)
322322
323323
324324 func keyVoteStakedLastUpdateHeight (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(address), toString(epoch)], SEP)
325325
326326
327327 func keyVoteStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP)
328328
329329
330330 func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s", "staked", userAddressStr, lpAssetIdStr], SEP)
331331
332332
333333 let factoryContract = readFactoryAddressOrFail()
334334
335335 let factoryCfg = readFactoryCfgOrFail(factoryContract)
336336
337337 let emissionContract = getEmissionAddressOrFail(factoryCfg)
338338
339339 let stakingContract = getStakingAddressOrFail(factoryCfg)
340340
341341 let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg)
342342
343343 let lpStakingPoolsContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(makeString(["%s", "lpStakingPoolsContract"], SEP)), wrapErr("lp_staking_pools contract address is undefined"))), wrapErr("invalid lp_staking_pools contract address"))
344344
345345 let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP)
346346
347347 let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract))
348348
349349 let keyVotingEmissionRateContract = makeString(["%s", "votingEmissionRateContract"], SEP)
350350
351351 let boostCoeff = {
352352 let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil)
353353 if ($isInstanceOf(@, "Int"))
354354 then @
355355 else throw(($getType(@) + " couldn't be cast to Int"))
356356 }
357357
358358 func userNumberByAddressOrFail (userAddress) = match getString(this, keyUser2NumMapping(toString(userAddress))) {
359359 case s: String =>
360360 valueOrErrorMessage(parseInt(s), wrapErr("invalid user number"))
361361 case _: Unit =>
362362 throwErr("invalid user")
363363 case _ =>
364364 throw("Match error")
365365 }
366366
367367
368368 func getGwxAmountTotal () = valueOrElse(getInteger(this, keyGwxTotal()), 0)
369369
370370
371371 func getLockedGwxAmount (userAddress) = {
372372 let functionName = "getLockedGwxAmount"
373373 let votingEmissionRateContract = valueOrErrorMessage( match getString(votingEmissionContract, keyVotingEmissionRateContract) {
374374 case _: Unit =>
375375 unit
376376 case s: String =>
377377 addressFromString(s)
378378 case _ =>
379379 throw("Match error")
380380 }, wrapErr("invalid voting emission rate address"))
381381 let lockedVotingEmissionRate = {
382382 let @ = invoke(votingEmissionContract, functionName, [toString(userAddress)], nil)
383383 if ($isInstanceOf(@, "Int"))
384384 then @
385385 else throw(($getType(@) + " couldn't be cast to Int"))
386386 }
387387 let lockedVotingEmission = {
388388 let @ = invoke(votingEmissionRateContract, functionName, [toString(userAddress)], nil)
389389 if ($isInstanceOf(@, "Int"))
390390 then @
391391 else throw(($getType(@) + " couldn't be cast to Int"))
392392 }
393393 let locked = max([lockedVotingEmissionRate, lockedVotingEmission])
394394 locked
395395 }
396396
397397
398398 func HistoryEntry (type,user,amount,lockStart,duration,gwxAmount,i) = {
399399 let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP)
400400 let historyDATA = makeString(["%d%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount), toString(lockStart), toString(duration), toString(gwxAmount)], SEP)
401401 StringEntry(historyKEY, historyDATA)
402402 }
403403
404404
405405 func StatsEntry (totalLockedInc,durationInc,lockCountInc,usersCountInc) = {
406406 let locksDurationSumInBlocksKEY = keyStatsLocksDurationSumInBlocks()
407407 let locksCountKEY = keyStatsLocksCount()
408408 let usersCountKEY = keyStatsUsersCount()
409409 let totalAmountKEY = keyLockParamTotalAmount()
410410 let locksDurationSumInBlocks = getIntOrZero(this, locksDurationSumInBlocksKEY)
411411 let locksCount = getIntOrZero(this, locksCountKEY)
412412 let usersCount = getIntOrZero(this, usersCountKEY)
413413 let totalAmount = getIntOrZero(this, totalAmountKEY)
414414 [IntegerEntry(locksDurationSumInBlocksKEY, (locksDurationSumInBlocks + durationInc)), IntegerEntry(locksCountKEY, (locksCount + lockCountInc)), IntegerEntry(usersCountKEY, (usersCount + usersCountInc)), IntegerEntry(totalAmountKEY, (totalAmount + totalLockedInc))]
415415 }
416416
417417
418418 func LockParamsEntry (userAddress,txId,amount,start,duration,gwxAmount,wxClaimed) = [StringEntry(keyLockParamsRecord(userAddress, txId), formatLockParamsRecord(amount, start, duration, gwxAmount, wxClaimed))]
419419
420420
421421 func extractOptionalPaymentAmountOrFail (i,expectedAssetId) = if ((size(i.payments) > 1))
422422 then throwErr("only one payment is allowed")
423423 else if ((size(i.payments) == 0))
424424 then 0
425425 else {
426426 let pmt = i.payments[0]
427427 if ((value(pmt.assetId) != expectedAssetId))
428428 then throwErr("invalid asset id in payment")
429429 else pmt.amount
430430 }
431431
432432
433433 func getUserGwxAmountTotal (userAddress) = valueOrElse(getInteger(this, keyUserGwxAmountTotal(userAddress)), 0)
434434
435435
436436 func getVotingEmissionEpochInfo () = {
437437 let $t01516415454 = {
438438 let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi()))
439439 let lastFinalizedEpoch = (currentEpochUi - 1)
440440 if ((0 > lastFinalizedEpoch))
441441 then throwErr("invalid epoch")
442442 else $Tuple2(currentEpochUi, lastFinalizedEpoch)
443443 }
444444 let currentEpochUi = $t01516415454._1
445445 let lastFinalizedEpoch = $t01516415454._2
446446 let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi)))
447447 $Tuple2(lastFinalizedEpoch, currentEpochStartHeight)
448448 }
449449
450450
451451 func getPoolAssetsByLpAssetId (lpAssetIdStr) = {
452452 let idxAmountAssetId = 4
453453 let idxPriceAssetId = 5
454454 let poolCfg = {
455455 let @ = invoke(factoryContract, "getPoolConfigByLpAssetIdREADONLY", [lpAssetIdStr], nil)
456456 if ($isInstanceOf(@, "List[Any]"))
457457 then @
458458 else throw(($getType(@) + " couldn't be cast to List[Any]"))
459459 }
460460 let amountAssetId = {
461461 let @ = poolCfg[idxAmountAssetId]
462462 if ($isInstanceOf(@, "String"))
463463 then @
464464 else throw(($getType(@) + " couldn't be cast to String"))
465465 }
466466 let priceAssetId = {
467467 let @ = poolCfg[idxPriceAssetId]
468468 if ($isInstanceOf(@, "String"))
469469 then @
470470 else throw(($getType(@) + " couldn't be cast to String"))
471471 }
472472 $Tuple2(amountAssetId, priceAssetId)
473473 }
474474
475475
476476 func getUserVoteFinalized (lpAssetIdStr,userAddressStr) = {
477477 let userAddress = addressFromStringValue(userAddressStr)
478478 let $t01614516225 = getVotingEmissionEpochInfo()
479479 let lastFinalizedEpoch = $t01614516225._1
480480 let currentEpochStartHeight = $t01614516225._2
481481 let $t01622816303 = getPoolAssetsByLpAssetId(lpAssetIdStr)
482482 let amountAssetId = $t01622816303._1
483483 let priceAssetId = $t01622816303._2
484484 let userVoteKey = keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch)
485485 let userVote = valueOrElse(getInteger(votingEmissionContract, userVoteKey), 0)
486486 userVote
487487 }
488488
489489
490490 func getUserVoteStaked (lpAssetIdStr,userAddressStr) = {
491491 let stakedByUser = valueOrElse(getInteger(stakingContract, keyStakedByUser(userAddressStr, lpAssetIdStr)), 0)
492492 let userVote = getUserVoteFinalized(lpAssetIdStr, userAddressStr)
493493 if ((stakedByUser == 0))
494494 then 0
495495 else userVote
496496 }
497497
498498
499499 func getVotingResultStaked (lpAssetIdStr) = {
500500 let $t01684716927 = getVotingEmissionEpochInfo()
501501 let lastFinalizedEpoch = $t01684716927._1
502502 let currentEpochStartHeight = $t01684716927._2
503503 let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0)
504504 let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart)
505505 votingResultStaked
506506 }
507507
508508
509509 func getVotingResultStakedIntegral (lpAssetIdStr) = {
510510 let $t01728917369 = getVotingEmissionEpochInfo()
511511 let lastFinalizedEpoch = $t01728917369._1
512512 let currentEpochStartHeight = $t01728917369._2
513513 let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
514514 let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)), 0)
515515 let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)), currentEpochStartHeight)
516516 let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight)
517517 let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev)
518518 votingResultStakedIntegral
519519 }
520520
521521
522522 func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = {
523523 let $t01820618286 = getVotingEmissionEpochInfo()
524524 let lastFinalizedEpoch = $t01820618286._1
525525 let currentEpochStartHeight = $t01820618286._2
526526 let votingResultStaked = getVotingResultStaked(lpAssetIdStr)
527527 let votingResultStakedNew = (votingResultStaked + stakedVoteDelta)
528528 let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr)
529529 [IntegerEntry(keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedNew), IntegerEntry(keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch), height), IntegerEntry(keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedIntegral)]
530530 }
531531
532532
533533 func getUserVoteStakedIntegral (lpAssetIdStr,userAddressStr) = {
534534 let $t01889718977 = getVotingEmissionEpochInfo()
535535 let lastFinalizedEpoch = $t01889718977._1
536536 let currentEpochStartHeight = $t01889718977._2
537537 let userAddress = addressFromStringValue(userAddressStr)
538538 let userVoteStaked = getUserVoteStaked(lpAssetIdStr, userAddressStr)
539539 let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)), 0)
540540 let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)), currentEpochStartHeight)
541541 let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight)
542542 let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev)
543543 userVoteStakedIntegral
544544 }
545545
546546
547547 func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = {
548548 let $t01976519845 = getVotingEmissionEpochInfo()
549549 let lastFinalizedEpoch = $t01976519845._1
550550 let currentEpochStartHeight = $t01976519845._2
551551 let userAddress = addressFromStringValue(userAddressStr)
552552 let userVoteFinalized = getUserVoteFinalized(lpAssetIdStr, userAddressStr)
553553 let actions = if ((userVoteFinalized == 0))
554554 then nil
555555 else {
556556 let stakedVoteDelta = if (edge)
557557 then userVoteFinalized
558558 else -(userVoteFinalized)
559559 let votingResultActions = refreshVotingResultStakedIntegral(lpAssetIdStr, stakedVoteDelta)
560560 let userVoteStakedIntegral = getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr)
561561 let voteActions = [IntegerEntry(keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch), height), IntegerEntry(keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch), userVoteStakedIntegral)]
562562 (votingResultActions ++ voteActions)
563563 }
564564 actions
565565 }
566566
567567
568568 func getStakedVotesIntegralsDiff (lpAssetIdStr,userAddressStr) = {
569569 let $t02069920779 = getVotingEmissionEpochInfo()
570570 let lastFinalizedEpoch = $t02069920779._1
571571 let currentEpochStartHeight = $t02069920779._2
572572 let userAddress = addressFromStringValue(userAddressStr)
573573 let userVoteStakedIntegralLastKey = keyVoteStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
574574 let userVoteStakedIntegralLast = valueOrElse(getInteger(this, userVoteStakedIntegralLastKey), 0)
575575 let votingResultStakedIntegralLastKey = keyVotingResultStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch)
576576 let votingResultStakedIntegralLast = valueOrElse(getInteger(this, votingResultStakedIntegralLastKey), 0)
577577 let userVoteStakedIntegral = getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr)
578578 let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr)
579579 let userVoteStakedIntegralDiff = (userVoteStakedIntegral - userVoteStakedIntegralLast)
580580 let votingResultStakedIntegralDiff = (votingResultStakedIntegral - votingResultStakedIntegralLast)
581581 $Tuple3([IntegerEntry(userVoteStakedIntegralLastKey, userVoteStakedIntegral), IntegerEntry(votingResultStakedIntegralLastKey, votingResultStakedIntegral)], userVoteStakedIntegralDiff, votingResultStakedIntegralDiff)
582582 }
583583
584584
585585 func refreshBoostEmissionIntegral () = {
586586 let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent())
587587 let boostingV2LastUpdateHeightOption = getInteger(this, keyBoostingV2LastUpdateHeight())
588588 let boostingV2IngergalOption = getInteger(this, keyBoostingV2Integral())
589589 let emissionEnd = getIntOrFail(emissionContract, keyEmissionEndBlock())
590590 let h = if ((height > emissionEnd))
591591 then emissionEnd
592592 else height
593593 let dh = match boostingV2LastUpdateHeightOption {
594594 case lastUpdateHeight: Int =>
595595 max([(h - lastUpdateHeight), 0])
596596 case _: Unit =>
597597 0
598598 case _ =>
599599 throw("Match error")
600600 }
601601 let boostEmissionPerBlock = ((wxEmissionPerBlock * (boostCoeff - 1)) / boostCoeff)
602602 let boostEmissionIntegralPrev = valueOrElse(boostingV2IngergalOption, 0)
603603 let boostEmissionIntegral = ((boostEmissionPerBlock * dh) + boostEmissionIntegralPrev)
604604 $Tuple2([IntegerEntry(keyBoostingV2Integral(), boostEmissionIntegral), IntegerEntry(keyBoostingV2LastUpdateHeight(), height)], boostEmissionIntegral)
605605 }
606606
607607
608608 func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = {
609609 let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address"))
610610 let userNum = userNumberByAddressOrFail(userAddress)
611611 if ((userNum == userNum))
612612 then {
613613 let EMPTYSTR = "empty"
614614 let poolWeight = if ((lpAssetIdStr != EMPTYSTR))
615615 then {
616616 let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)), wrapErr(("unsupported lp asset " + lpAssetIdStr)))
617617 getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
618618 }
619619 else if (readOnly)
620620 then 0
621621 else throwErr(("not readonly mode: unsupported lp asset " + lpAssetIdStr))
622622 let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNum, lpAssetIdStr)
623623 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNum)
624624 let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), getIntOrZero(this, userBoostEmissionLastIntegralKEY))
625625 let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
626626 let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral)
627627 if ((0 > userBoostEmissionIntegral))
628628 then throwErr("wrong calculations")
629629 else {
630630 let $t02432124460 = getStakedVotesIntegralsDiff(lpAssetIdStr, userAddressStr)
631631 let stakedVotesIntegralsActions = $t02432124460._1
632632 let userVoteIntegralDiff = $t02432124460._2
633633 let totalVotesIntegralDiff = $t02432124460._3
634634 let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT)
635635 let userBoostAvaliableToClaimTotalNew = if ((totalVotesIntegralDiff == 0))
636636 then 0
637637 else fraction(poolUserBoostEmissionIntegral, userVoteIntegralDiff, totalVotesIntegralDiff)
638638 let dataState = ([IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] ++ stakedVotesIntegralsActions)
639639 let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(poolWeight), toString(userVoteIntegralDiff), toString(totalVotesIntegralDiff)], ":")
640640 $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug)
641641 }
642642 }
643643 else throw("Strict value is not equal to itself.")
644644 }
645645
646646
647647 func lockActions (i,durationMonths) = {
648648 let durationMonthsAllowed = [1, 3, 6, 12, 24, 48]
649649 if (!(containsElement(durationMonthsAllowed, durationMonths)))
650650 then throwErr("invalid duration")
651651 else {
652652 let duration = (durationMonths * blocksInMonth)
653653 let assetIdStr = toBase58String(assetId)
654654 if ((size(i.payments) != 1))
655655 then throwErr("invalid payment - exact one payment must be attached")
656656 else {
657657 let pmt = i.payments[0]
658658 let pmtAmount = pmt.amount
659659 if ((assetId != value(pmt.assetId)))
660660 then throwErr((("invalid asset is in payment - " + assetIdStr) + " is expected"))
661661 else {
662662 let nextUserNumKEY = keyNextUserNum()
663663 let userAddress = i.caller
664664 let userAddressStr = toString(userAddress)
665665 let userIsExisting = isDefined(getString(keyUser2NumMapping(userAddressStr)))
666666 let userNumStr = if (userIsExisting)
667667 then value(getString(keyUser2NumMapping(userAddressStr)))
668668 else toString(getIntOrFail(this, nextUserNumKEY))
669669 let userNum = parseIntValue(userNumStr)
670670 let lockStart = height
671671 if (if ((minLockAmount > pmtAmount))
672672 then (userAddress != lpStakingPoolsContract)
673673 else false)
674674 then throwErr(("amount is less then minLockAmount=" + toString(minLockAmount)))
675675 else if ((minLockDuration > duration))
676676 then throwErr(("passed duration is less then minLockDuration=" + toString(minLockDuration)))
677677 else if ((duration > maxLockDuration))
678678 then throwErr(("passed duration is greater then maxLockDuration=" + toString(maxLockDuration)))
679679 else {
680680 let coeffX8 = fraction(duration, MULT8, maxLockDuration)
681681 let gWxAmountStart = fraction(pmtAmount, coeffX8, MULT8)
682682 let gwxAmountTotal = getGwxAmountTotal()
683683 let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNum)
684684 let boostEmissionIntegral = refreshBoostEmissionIntegral()._2
685685 let userGwxAmountTotal = getUserGwxAmountTotal(userAddress)
686686 let gwxRewardInv = reentrantInvoke(gwxRewardContract, "refreshUserReward", [userAddress.bytes], nil)
687687 if ((gwxRewardInv == gwxRewardInv))
688688 then {
689689 let arr = if (userIsExisting)
690690 then nil
691691 else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)]
692692 $Tuple2(((((arr ++ LockParamsEntry(userAddress, i.transactionId, pmtAmount, lockStart, duration, gWxAmountStart, 0)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting)
693693 then 0
694694 else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, gWxAmountStart, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyGwxTotal(), (gwxAmountTotal + gWxAmountStart)), IntegerEntry(keyUserGwxAmountTotal(userAddress), (userGwxAmountTotal + gWxAmountStart))]), gWxAmountStart)
695695 }
696696 else throw("Strict value is not equal to itself.")
697697 }
698698 }
699699 }
700700 }
701701 }
702702
703703
704704 func getWxWithdrawable (userAddress,txIdOption) = {
705705 let userRecordArray = readLockParamsRecordOrFail(userAddress, txIdOption)
706706 let userAmount = parseIntValue(userRecordArray[IdxLockAmount])
707707 let lockStart = parseIntValue(userRecordArray[IdxLockStart])
708708 let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
709709 let lockEnd = (lockStart + lockDuration)
710710 let wxClaimed = parseIntValue(userRecordArray[IdxLockWxClaimed])
711711 let gwxAmount = parseIntValue(userRecordArray[IdxLockGwxAmount])
712712 let t = ((height - lockStart) / blocksInPeriod)
713713 let exponent = fraction(toBigInt(t), (toBigInt((8 * blocksInPeriod)) * MULT18BI), toBigInt(lockDuration))
714714 let wxWithdrawable = if ((height > lockEnd))
715715 then userAmount
716716 else (toInt(fraction(toBigInt(userAmount), (MULT18BI - pow(toBigInt(5), 1, exponent, SCALE18, SCALE18, DOWN)), MULT18BI)) - wxClaimed)
717717 wxWithdrawable
718718 }
719719
720720
721721 @Callable(i)
722722 func constructor (factoryAddressStr,lockAssetIdStr,minLockAmount,minDuration,maxDuration,mathContract) = {
723723 let checkCaller = mustManager(i)
724724 if ((checkCaller == checkCaller))
725725 then ([IntegerEntry(keyNextUserNum(), 0), StringEntry(keyConfig(), formatConfig(lockAssetIdStr, minLockAmount, minDuration, maxDuration, mathContract)), StringEntry(keyFactoryAddress(), factoryAddressStr)] ++ StatsEntry(0, 0, 0, 0))
726726 else throw("Strict value is not equal to itself.")
727727 }
728728
729729
730730
731731 @Callable(i)
732732 func lockRef (duration,referrerAddress,signature) = {
733733 let $t02942729492 = lockActions(i, duration)
734734 let lockActionsResult = $t02942729492._1
735735 let gWxAmountStart = $t02942729492._2
736736 let referralAddress = toString(i.caller)
737737 let refInv = if (if ((referrerAddress == ""))
738738 then true
739739 else (signature == base58''))
740740 then unit
741741 else invoke(referralsContractAddressOrFail, "createPair", [referralProgramName, referrerAddress, referralAddress, signature], nil)
742742 if ((refInv == refInv))
743743 then {
744744 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
745745 if ((updateRefActivity == updateRefActivity))
746746 then $Tuple2(lockActionsResult, unit)
747747 else throw("Strict value is not equal to itself.")
748748 }
749749 else throw("Strict value is not equal to itself.")
750750 }
751751
752752
753753
754754 @Callable(i)
755755 func lock (duration) = {
756756 let $t02995030015 = lockActions(i, duration)
757757 let lockActionsResult = $t02995030015._1
758758 let gWxAmountStart = $t02995030015._2
759759 let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil)
760760 if ((updateRefActivity == updateRefActivity))
761761 then $Tuple2(lockActionsResult, unit)
762762 else throw("Strict value is not equal to itself.")
763763 }
764764
765765
766766
767767 @Callable(i)
768768 func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller))
769769 then throwErr("permissions denied")
770770 else {
771771 let $t03032530427 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false)
772772 let userBoostAvailable = $t03032530427._1
773773 let dataState = $t03032530427._2
774774 let debug = $t03032530427._3
775775 $Tuple2(dataState, [userBoostAvailable])
776776 }
777777
778778
779779
780780 @Callable(i)
781781 func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = {
782782 let $t03055930660 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true)
783783 let userBoostAvailable = $t03055930660._1
784784 let dataState = $t03055930660._2
785785 let debug = $t03055930660._3
786786 $Tuple2(nil, [userBoostAvailable, debug])
787787 }
788788
789789
790790
791791 @Callable(i)
792-func unlock (txIdStr,amount) = {
792+func unlock (txIdStr) = {
793793 let userAddress = i.caller
794794 let userAddressStr = toString(userAddress)
795795 let txId = fromBase58String(txIdStr)
796796 let userRecordArray = readLockParamsRecordOrFail(userAddress, if ((txIdStr == ""))
797797 then unit
798798 else txId)
799799 let userAmount = parseIntValue(userRecordArray[IdxLockAmount])
800800 let lockStart = parseIntValue(userRecordArray[IdxLockStart])
801801 let lockDuration = parseIntValue(userRecordArray[IdxLockDuration])
802802 let lockEnd = (lockStart + lockDuration)
803803 let wxClaimed = parseIntValue(userRecordArray[IdxLockWxClaimed])
804804 let gwxAmount = parseIntValue(userRecordArray[IdxLockGwxAmount])
805805 let t = ((height - lockStart) / blocksInPeriod)
806806 let wxWithdrawable = getWxWithdrawable(userAddress, if ((txIdStr == ""))
807807 then unit
808808 else txId)
809- if ((amount > wxWithdrawable))
810- then throwErr(("maximum amount to unlock: " + toString(wxWithdrawable)))
809+ let coeffX8 = fraction(lockDuration, MULT8, maxLockDuration)
810+ let gWxAmountStart = fraction(userAmount, coeffX8, MULT8)
811+ let gwxBurned = min([fraction((t * blocksInPeriod), gWxAmountStart, maxLockDuration), gwxAmount])
812+ let gwxRemaining = ensurePositive((gwxAmount - gwxBurned), "gwxRemaining")
813+ let lockedGwxAmount = getLockedGwxAmount(userAddress)
814+ if ((0 >= userAmount))
815+ then throwErr("nothing to unlock")
811816 else {
812- let coeffX8 = fraction(lockDuration, MULT8, maxLockDuration)
813- let gWxAmountStart = fraction(userAmount, coeffX8, MULT8)
814- let gwxBurned = fraction((t * blocksInPeriod), gWxAmountStart, maxLockDuration)
815- let gwxRemaining = ensurePositive((gwxAmount - gwxBurned), "gwxRemaining")
816- let lockedGwxAmount = getLockedGwxAmount(userAddress)
817- if ((0 >= userAmount))
818- then throwErr("nothing to unlock")
817+ let gwxAmountTotal = getGwxAmountTotal()
818+ let userGwxAmountTotal = getUserGwxAmountTotal(userAddress)
819+ let userGwxAmountTotalNew = ensurePositive((userGwxAmountTotal - gwxBurned), "userGwxAmountTotalNew")
820+ if ((lockedGwxAmount > userGwxAmountTotalNew))
821+ then throwErr(("locked gwx amount: " + toString(lockedGwxAmount)))
819822 else {
820- let gwxAmountTotal = getGwxAmountTotal()
821- let userGwxAmountTotal = getUserGwxAmountTotal(userAddress)
822- let userGwxAmountTotalNew = ensurePositive((userGwxAmountTotal - gwxBurned), "userGwxAmountTotalNew")
823- if ((lockedGwxAmount > userGwxAmountTotalNew))
824- then throwErr(("locked gwx amount: " + toString(lockedGwxAmount)))
825- else {
826- let gwxRewardInv = reentrantInvoke(gwxRewardContract, "refreshUserReward", [userAddress.bytes], nil)
827- if ((gwxRewardInv == gwxRewardInv))
828- then ((((LockParamsEntry(userAddress, txId, userAmount, lockStart, lockDuration, gwxRemaining, (wxClaimed + amount)) ++ StatsEntry(-(amount), 0, 0, 0)) :+ HistoryEntry("unlock", userAddressStr, amount, lockStart, lockDuration, gwxBurned, i)) :+ ScriptTransfer(userAddress, amount, assetId)) ++ [IntegerEntry(keyGwxTotal(), ensurePositive((gwxAmountTotal - gwxBurned), "gwxTotal")), IntegerEntry(keyUserGwxAmountTotal(userAddress), userGwxAmountTotalNew)])
829- else throw("Strict value is not equal to itself.")
830- }
823+ let gwxRewardInv = reentrantInvoke(gwxRewardContract, "refreshUserReward", [userAddress.bytes], nil)
824+ if ((gwxRewardInv == gwxRewardInv))
825+ then ((((LockParamsEntry(userAddress, txId, userAmount, lockStart, lockDuration, gwxRemaining, (wxClaimed + wxWithdrawable)) ++ StatsEntry(-(wxWithdrawable), 0, 0, 0)) :+ HistoryEntry("unlock", userAddressStr, wxWithdrawable, lockStart, lockDuration, gwxBurned, i)) :+ ScriptTransfer(userAddress, wxWithdrawable, assetId)) ++ [IntegerEntry(keyGwxTotal(), ensurePositive((gwxAmountTotal - gwxBurned), "gwxTotal")), IntegerEntry(keyUserGwxAmountTotal(userAddress), userGwxAmountTotalNew)])
826+ else throw("Strict value is not equal to itself.")
831827 }
832828 }
833829 }
834830
835831
836832
837833 @Callable(i)
838834 func gwxUserInfoREADONLY (userAddressStr) = {
839835 let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address"))
840836 let gwxAmount = getUserGwxAmountTotal(userAddress)
841837 $Tuple2(nil, [gwxAmount])
842838 }
843839
844840
845841
846842 @Callable(i)
847843 func userMaxDurationREADONLY (userAddressStr) = $Tuple2(nil, $Tuple2("increaseLock", maxLockDuration))
848844
849845
850846
851847 @Callable(i)
852848 func getUserGwxAmountAtHeightREADONLY (userAddressStr,targetHeight) = {
853849 let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address"))
854850 let gwxAmount = getUserGwxAmountTotal(userAddress)
855851 $Tuple2(nil, gwxAmount)
856852 }
857853
858854
859855
860856 @Callable(i)
861857 func getUserGwxAmount (userAddressStr) = {
862858 let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address"))
863859 let gwxAmount = getUserGwxAmountTotal(userAddress)
864860 $Tuple2(nil, gwxAmount)
865861 }
866862
867863
868864
869865 @Callable(i)
870866 func getGwxTotalREADONLY () = $Tuple2(nil, getGwxAmountTotal())
871867
872868
873869
874870 @Callable(i)
875871 func onBoostEmissionUpdate () = {
876872 let checkCaller = if ((i.caller == emissionContract))
877873 then true
878874 else mustManager(i)
879875 if ((checkCaller == checkCaller))
880876 then refreshBoostEmissionIntegral()
881877 else throw("Strict value is not equal to itself.")
882878 }
883879
884880
885881
886882 @Callable(i)
887883 func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = {
888884 let checkCaller = if ((i.caller == stakingContract))
889885 then true
890886 else mustManager(i)
891887 if ((checkCaller == checkCaller))
892888 then {
893889 let actions = refreshVoteStakedIntegral(lpAssetIdStr, userAddressStr, edge)
894890 $Tuple2(actions, unit)
895891 }
896892 else throw("Strict value is not equal to itself.")
897893 }
898894
899895
900896
901897 @Callable(i)
902898 func getVotingResultStakedREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStaked(lpAssetIdStr))
903899
904900
905901
906902 @Callable(i)
907903 func getVotingResultStakedIntegralREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStakedIntegral(lpAssetIdStr))
908904
909905
910906
911907 @Callable(i)
912908 func getUserVoteFinalizedREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteFinalized(lpAssetIdStr, userAddressStr))
913909
914910
915911
916912 @Callable(i)
917913 func getUserVoteStakedIntegralREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr))
918914
919915
920916 @Verifier(tx)
921917 func verify () = {
922918 let targetPublicKey = match managerPublicKeyOrUnit() {
923919 case pk: ByteVector =>
924920 pk
925921 case _: Unit =>
926922 tx.senderPublicKey
927923 case _ =>
928924 throw("Match error")
929925 }
930926 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
931927 }
932928

github/deemru/w8io/026f985 
104.83 ms