tx · 7VasV9EDZPvJLDMRqomGxTE5diWCUrALey8gHsHuPgqa 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz: -0.01400000 Waves 2021.12.15 12:24 [1835181] smart account 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz > SELF 0.00000000 Waves
{ "type": 13, "id": "7VasV9EDZPvJLDMRqomGxTE5diWCUrALey8gHsHuPgqa", "fee": 1400000, "feeAssetId": null, "timestamp": 1639560271131, "version": 1, "sender": "3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz", "senderPublicKey": "D28XoueZWsMfm8Y5pa6C5ZFuYoWgre2Wm8tzJANJgMnq", "proofs": [ "2bR6ohPrk3QNXfaqa25aD6RtsgFNcr9jVS1UgMFT68C4J6ZpKPst4Q2LLQtHRkbx3KArtQKPZMX3cH1pko2RXGWE" ], "script": "base64:AAIFAAAAAAAAACAIAhIDCgEIEgASBAoCCAESAwoBCBIECgIICBIECgIICAAAAEcAAAAABlNDQUxFOAAAAAAAAAAACAAAAAAFTVVMVDgAAAAAAAX14QAAAAAAB1NDQUxFMTgAAAAAAAAAABIAAAAABk1VTFQxOAkAATYAAAABAA3gtrOnZAAAAAAAAANTRVACAAAAAl9fAAAAAA5QT09MV0VJR0hUTVVMVAUAAAAFTVVMVDgBAAAACWFzQW55TGlzdAAAAAEAAAADdmFsBAAAAAckbWF0Y2gwBQAAAAN2YWwDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACUxpc3RbQW55XQQAAAAKdmFsQW55THlzdAUAAAAHJG1hdGNoMAUAAAAKdmFsQW55THlzdAkAAAIAAAABAgAAABtmYWlsIHRvIGNhc3QgaW50byBMaXN0W0FueV0BAAAABWFzSW50AAAAAQAAAAN2YWwEAAAAByRtYXRjaDAFAAAAA3ZhbAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAZ2YWxJbnQFAAAAByRtYXRjaDAFAAAABnZhbEludAkAAAIAAAABAgAAABVmYWl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SW50ZWdyYWxTVEFURQgFAAAADSR0MDE4NTM2MTg2NDYAAAACXzIEAAAACXBvb2xERUJVRwgFAAAADSR0MDE4NTM2MTg2NDYAAAACXzMFAAAAEXBvb2xJbnRlZ3JhbFNUQVRFAAAAAAHFvoA=", "chainId": 84, "height": 1835181, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4ANkMz4DGaFvtGXBkYWpkTGidXYLDE6Ztq6JTmLaPjwF Next: 4i9yCgAGHmuCmXHjoez59gdBb3pUf34c4QWGYQ7dCvv9 Diff:
Old | New | Differences | |
---|---|---|---|
98 | 98 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
99 | 99 | ||
100 | 100 | ||
101 | - | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(keyFactoryAddress())) | |
102 | - | ||
103 | - | ||
104 | - | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
101 | + | func readLpList (factory) = split(valueOrElse(getString(factory, keyFactoryLpList()), ""), SEP) | |
105 | 102 | ||
106 | 103 | ||
107 | 104 | func readFactoryCfgOrFail (factory) = split(getStringByAddressOrFail(factory, keyFactoryCfg()), SEP) | |
200 | 197 | func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount)) | |
201 | 198 | ||
202 | 199 | ||
203 | - | let factoryContract = readFactoryAddressOrFail() | |
200 | + | let factoryAddress = getStringOrFail(keyFactoryAddress()) | |
201 | + | ||
202 | + | let factoryContract = addressFromStringValue(factoryAddress) | |
204 | 203 | ||
205 | 204 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
206 | 205 | ||
221 | 220 | else throw("calcWxPerLpIntegralUserLast: unexpected state") | |
222 | 221 | ||
223 | 222 | ||
224 | - | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
225 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
223 | + | func refreshPoolINTEGRALS (lpAssetIdStr,poolAddressStr,lpDeltaAmount) = { | |
226 | 224 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
227 | - | let stakedByUser = readStaked(stakedByUserKEY) | |
228 | 225 | let stakedTotal = readStaked(stakedTotalKEY) | |
229 | 226 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
230 | 227 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
231 | 228 | let MULT3 = 1000 | |
232 | - | let | |
233 | - | let | |
229 | + | let wxEmissionPerBlockX3 = (getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) * MULT3) | |
230 | + | let poolWxEmissionPerBlockX3 = fraction(wxEmissionPerBlockX3, poolWeight, (POOLWEIGHTMULT * 3)) | |
234 | 231 | let wxPerLpIntegralKEY = keyWxPerLpIntegral(lpAssetIdStr) | |
235 | 232 | let wxPerLpIntegralLastUpdHeightKEY = keyWxPerLpIntegralLastUpdHeight(lpAssetIdStr) | |
233 | + | let wxPerLpKEY = keyWxPerLp(lpAssetIdStr) | |
234 | + | let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock) | |
235 | + | let wxPerLpIntegral = getIntOrZero(this, wxPerLpIntegralKEY) | |
236 | + | let wxPerLpOrZeroX3 = 0 | |
237 | + | let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0]) | |
238 | + | let wxPerLpX3 = if ((wxPerLpOrZeroX3 != 0)) | |
239 | + | then wxPerLpOrZeroX3 | |
240 | + | else fraction(poolWxEmissionPerBlockX3, MULT8, stakedTotal) | |
241 | + | let stakedTotalNew = (stakedTotal + lpDeltaAmount) | |
242 | + | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX3 * dh)) | |
243 | + | let wxPerLpX3New = (poolWxEmissionPerBlockX3 / stakedTotalNew) | |
244 | + | let wxPerLpIntegralLastUpdHeightNew = height | |
245 | + | let debug = makeString([toString(wxPerLpIntegralNew), toString(dh), toString(wxPerLpX3), toString(stakedTotal), toString(poolWxEmissionPerBlockX3), toString(wxEmissionPerBlockX3), toString(poolWeight)], "::") | |
246 | + | $Tuple3(wxPerLpIntegralNew, [IntegerEntry(wxPerLpIntegralKEY, wxPerLpIntegralNew), IntegerEntry(wxPerLpIntegralLastUpdHeightKEY, wxPerLpIntegralLastUpdHeightNew), IntegerEntry(wxPerLpKEY, wxPerLpX3New)], debug) | |
247 | + | } | |
248 | + | ||
249 | + | ||
250 | + | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
251 | + | let $t01032310445 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
252 | + | let wxPerLpIntegralNew = $t01032310445._1 | |
253 | + | let poolIntegralSTATE = $t01032310445._2 | |
254 | + | let poolDEBUG = $t01032310445._3 | |
255 | + | let MULT3 = 1000 | |
256 | + | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
257 | + | let stakedByUser = readStaked(stakedByUserKEY) | |
236 | 258 | let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr) | |
237 | 259 | let wxPerLpIntegralUserLastUpdHeightKEY = keyWxPerLpIntegralUserLastUpdHeight(lpAssetIdStr, userAddressStr) | |
238 | - | let wxPerLpKEY = keyWxPerLp(lpAssetIdStr) | |
239 | 260 | let wxPerLpIntegralUserLastKEY = keyWxPerLpIntegralUserLast(lpAssetIdStr, userAddressStr) | |
240 | - | let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock) | |
241 | - | let wxPerLpIntegral = getIntOrZero(this, wxPerLpIntegralKEY) | |
242 | 261 | let wxToClaimUser = getIntOrZero(this, wxToClaimUserKEY) | |
243 | 262 | let wxPerLpIntegralUserLastUpdHeightOrZero = getIntOrZero(this, wxPerLpIntegralUserLastUpdHeightKEY) | |
244 | - | let wxPerLpOrZeroX8 = 0 | |
245 | - | let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0]) | |
246 | - | let wxPerLpX8 = if ((wxPerLpOrZeroX8 != 0)) | |
247 | - | then wxPerLpOrZeroX8 | |
248 | - | else fraction(poolWxEmissionPerBlock, MULT8, stakedTotal) | |
249 | - | let stakedTotalNew = (stakedTotal + lpDeltaAmount) | |
250 | - | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX8 * dh)) | |
251 | 263 | let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(stakedByUser, wxPerLpIntegralUserLastUpdHeightOrZero, wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY) | |
252 | 264 | let wxToClaimUserNew = (wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), stakedByUser, (MULT8 * MULT3))) | |
253 | 265 | let wxPerLpIntegralUserLastNew = wxPerLpIntegralNew | |
254 | - | let wxPerLpNewX8 = 0 | |
255 | - | let wxPerLpIntegralLastUpdHeightNew = height | |
256 | 266 | let wxPerLpIntegralUserLastUpdHeightNew = height | |
257 | - | let debug = makeString([toString(wxToClaimUserNew), toString( | |
258 | - | $Tuple3(wxToClaimUserNew, [ | |
267 | + | let debug = makeString([toString(wxToClaimUserNew), toString(wxPerLpIntegralUserLast), toString(stakedByUser), poolDEBUG, toString(height)], "::") | |
268 | + | $Tuple3(wxToClaimUserNew, (poolIntegralSTATE ++ [IntegerEntry(wxToClaimUserKEY, wxToClaimUserNew), IntegerEntry(wxPerLpIntegralUserLastUpdHeightKEY, wxPerLpIntegralUserLastUpdHeightNew), IntegerEntry(wxPerLpIntegralUserLastKEY, wxPerLpIntegralUserLastNew)]), debug) | |
259 | 269 | } | |
260 | 270 | ||
261 | 271 | ||
283 | 293 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
284 | 294 | let stakedByUser = readStaked(stakedByUserKEY) | |
285 | 295 | let stakedTotal = readStaked(stakedTotalKEY) | |
286 | - | let $ | |
287 | - | let wxToClaimUserNew = $ | |
288 | - | let integralSTATE = $ | |
289 | - | let debug = $ | |
296 | + | let $t01298813105 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
297 | + | let wxToClaimUserNew = $t01298813105._1 | |
298 | + | let integralSTATE = $t01298813105._2 | |
299 | + | let debug = $t01298813105._3 | |
290 | 300 | ([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
291 | 301 | } | |
292 | 302 | ||
301 | 311 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
302 | 312 | let stakedByUser = readStaked(stakedByUserKEY) | |
303 | 313 | let stakedTotal = readStaked(stakedTotalKEY) | |
304 | - | let $ | |
305 | - | let wxToClaimUserNew = $ | |
306 | - | let integralSTATE = $ | |
307 | - | let debug = $ | |
314 | + | let $t01392214040 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount)) | |
315 | + | let wxToClaimUserNew = $t01392214040._1 | |
316 | + | let integralSTATE = $t01392214040._2 | |
317 | + | let debug = $t01392214040._3 | |
308 | 318 | if ((amount > stakedByUser)) | |
309 | 319 | then throw("passed amount is less then available") | |
310 | 320 | else ([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
325 | 335 | let claimedByUserMinReward = getIntOrZero(this, claimedByUserMinRewardKEY) | |
326 | 336 | let claimedByUserBoostReward = getIntOrZero(this, claimedByUserBoostRewardKEY) | |
327 | 337 | let claimedTotal = getIntOrZero(this, claimedTotalKEY) | |
328 | - | let $ | |
329 | - | let wxToClaimUserNew = $ | |
330 | - | let integralSTATE = $ | |
331 | - | let debug = $ | |
338 | + | let $t01523215344 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
339 | + | let wxToClaimUserNew = $t01523215344._1 | |
340 | + | let integralSTATE = $t01523215344._2 | |
341 | + | let debug = $t01523215344._3 | |
332 | 342 | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
333 | 343 | if ((0 >= availableToClaim)) | |
334 | 344 | then throw("nothing to claim") | |
335 | 345 | else { | |
336 | 346 | let wxAmountBoostTotal = asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]) | |
337 | - | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
338 | 347 | let minRewardPart = availableToClaim | |
339 | 348 | let boostRewardPart = min([(minRewardPart * 2), wxAmountBoostTotal]) | |
340 | 349 | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [minRewardPart], nil))[0]) | |
356 | 365 | let stakedTotal = readStaked(stakedTotalKEY) | |
357 | 366 | let claimedByUser = getIntOrZero(this, claimedByUserKEY) | |
358 | 367 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
359 | - | let poolWeightMult = MULT8 | |
360 | 368 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
361 | 369 | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
362 | 370 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
363 | 371 | let passedBlocks = if ((emissionStartBlock > height)) | |
364 | 372 | then 0 | |
365 | 373 | else (height - emissionStartBlock) | |
366 | - | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, | |
374 | + | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
367 | 375 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
368 | - | let $ | |
369 | - | let wxToClaimUserNew = $ | |
370 | - | let integralSTATE = $ | |
371 | - | let debug = $ | |
376 | + | let $t01754417656 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
377 | + | let wxToClaimUserNew = $t01754417656._1 | |
378 | + | let integralSTATE = $t01754417656._2 | |
379 | + | let debug = $t01754417656._3 | |
372 | 380 | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
373 | 381 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
374 | 382 | let wxAmountBoostTotal = asInt(boostInvResult[0]) | |
380 | 388 | } | |
381 | 389 | ||
382 | 390 | ||
391 | + | ||
392 | + | @Callable(i) | |
393 | + | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
394 | + | then throw("permissions denied") | |
395 | + | else { | |
396 | + | let $t01853618646 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
397 | + | let wxPerLpIntegralNew = $t01853618646._1 | |
398 | + | let poolIntegralSTATE = $t01853618646._2 | |
399 | + | let poolDEBUG = $t01853618646._3 | |
400 | + | poolIntegralSTATE | |
401 | + | } | |
402 | + | ||
403 | + |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SCALE8 = 8 | |
5 | 5 | ||
6 | 6 | let MULT8 = 100000000 | |
7 | 7 | ||
8 | 8 | let SCALE18 = 18 | |
9 | 9 | ||
10 | 10 | let MULT18 = toBigInt(1000000000000000000) | |
11 | 11 | ||
12 | 12 | let SEP = "__" | |
13 | 13 | ||
14 | 14 | let POOLWEIGHTMULT = MULT8 | |
15 | 15 | ||
16 | 16 | func asAnyList (val) = match val { | |
17 | 17 | case valAnyLyst: List[Any] => | |
18 | 18 | valAnyLyst | |
19 | 19 | case _ => | |
20 | 20 | throw("fail to cast into List[Any]") | |
21 | 21 | } | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func asInt (val) = match val { | |
25 | 25 | case valInt: Int => | |
26 | 26 | valInt | |
27 | 27 | case _ => | |
28 | 28 | throw("fail to cast into Int") | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func asString (val) = match val { | |
33 | 33 | case valStr: String => | |
34 | 34 | valStr | |
35 | 35 | case _ => | |
36 | 36 | throw("fail to cast into Int") | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func asByteVector (val) = match val { | |
41 | 41 | case valBin: ByteVector => | |
42 | 42 | valBin | |
43 | 43 | case _ => | |
44 | 44 | throw("fail to cast into Int") | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined")) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult)) | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18)) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | let IdxFactoryCfgStakingDapp = 1 | |
73 | 73 | ||
74 | 74 | let IdxFactoryCfgBoostingDapp = 2 | |
75 | 75 | ||
76 | 76 | let IdxFactoryCfgIdoDapp = 3 | |
77 | 77 | ||
78 | 78 | let IdxFactoryCfgTeamDapp = 4 | |
79 | 79 | ||
80 | 80 | let IdxFactoryCfgEmissionDapp = 5 | |
81 | 81 | ||
82 | 82 | let IdxFactoryCfgRestDapp = 6 | |
83 | 83 | ||
84 | 84 | let IdxFactoryCfgSlippageDapp = 7 | |
85 | 85 | ||
86 | 86 | func keyFactoryCfg () = "%s__factoryConfig" | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func keyFactoryLpList () = "%s__lpTokensList" | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
99 | 99 | ||
100 | 100 | ||
101 | - | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(keyFactoryAddress())) | |
102 | - | ||
103 | - | ||
104 | - | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
101 | + | func readLpList (factory) = split(valueOrElse(getString(factory, keyFactoryLpList()), ""), SEP) | |
105 | 102 | ||
106 | 103 | ||
107 | 104 | func readFactoryCfgOrFail (factory) = split(getStringByAddressOrFail(factory, keyFactoryCfg()), SEP) | |
108 | 105 | ||
109 | 106 | ||
110 | 107 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
111 | 108 | ||
112 | 109 | ||
113 | 110 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
114 | 111 | ||
115 | 112 | ||
116 | 113 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
117 | 114 | ||
118 | 115 | ||
119 | 116 | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
120 | 117 | ||
121 | 118 | ||
122 | 119 | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
123 | 120 | ||
124 | 121 | ||
125 | 122 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
126 | 123 | ||
127 | 124 | ||
128 | 125 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
129 | 126 | ||
130 | 127 | ||
131 | 128 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
132 | 129 | ||
133 | 130 | ||
134 | 131 | func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP) | |
135 | 132 | ||
136 | 133 | ||
137 | 134 | func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr) | |
138 | 135 | ||
139 | 136 | ||
140 | 137 | func keyClaimedByUser (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimed", userAddressStr, lpAssetIdStr], SEP) | |
141 | 138 | ||
142 | 139 | ||
143 | 140 | func keyClaimedByUserMinReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedMinReward", userAddressStr, lpAssetIdStr], SEP) | |
144 | 141 | ||
145 | 142 | ||
146 | 143 | func keyClaimedByUserBoostReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedBoostReward", userAddressStr, lpAssetIdStr], SEP) | |
147 | 144 | ||
148 | 145 | ||
149 | 146 | func keyClaimedTotal (lpAssetIdStr) = makeString(["%s%s%s__claimed", "total", lpAssetIdStr], SEP) | |
150 | 147 | ||
151 | 148 | ||
152 | 149 | func readStaked (key) = valueOrElse(getInteger(this, key), 0) | |
153 | 150 | ||
154 | 151 | ||
155 | 152 | func keyLastTotalLpBalance (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "bal"], SEP) | |
156 | 153 | ||
157 | 154 | ||
158 | 155 | func keyLastUserLpBalance (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "bal"], SEP) | |
159 | 156 | ||
160 | 157 | ||
161 | 158 | func keyTotalLpBalanceIntegral (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "balINT"], SEP) | |
162 | 159 | ||
163 | 160 | ||
164 | 161 | func keyUserLpBalanceIntegral (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "balINT"], SEP) | |
165 | 162 | ||
166 | 163 | ||
167 | 164 | func keyTotalLpBalanceIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "lastUpd"], SEP) | |
168 | 165 | ||
169 | 166 | ||
170 | 167 | func keyUserLpBalanceIntegralLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "lastUpd"], SEP) | |
171 | 168 | ||
172 | 169 | ||
173 | 170 | func keyWxPerLpIntegral (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpInt"], SEP) | |
174 | 171 | ||
175 | 172 | ||
176 | 173 | func keyWxPerLpIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpIntH"], SEP) | |
177 | 174 | ||
178 | 175 | ||
179 | 176 | func keyWxToClaimUser (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpInt"], SEP) | |
180 | 177 | ||
181 | 178 | ||
182 | 179 | func keyWxPerLpIntegralUserLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpIntH"], SEP) | |
183 | 180 | ||
184 | 181 | ||
185 | 182 | func keyWxPerLp (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLp"], SEP) | |
186 | 183 | ||
187 | 184 | ||
188 | 185 | func keyWxPerLpX18 (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLpX18"], SEP) | |
189 | 186 | ||
190 | 187 | ||
191 | 188 | func keyWxPerLpIntegralUserLast (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "uIntL"], SEP) | |
192 | 189 | ||
193 | 190 | ||
194 | 191 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
195 | 192 | ||
196 | 193 | ||
197 | 194 | func formatHistoryRecord (userAddress,lpAssetId,type,amount) = makeString(["%s%s%s%d%d%d", userAddress, lpAssetId, type, toString(height), toString(lastBlock.timestamp), toString(amount)], SEP) | |
198 | 195 | ||
199 | 196 | ||
200 | 197 | func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount)) | |
201 | 198 | ||
202 | 199 | ||
203 | - | let factoryContract = readFactoryAddressOrFail() | |
200 | + | let factoryAddress = getStringOrFail(keyFactoryAddress()) | |
201 | + | ||
202 | + | let factoryContract = addressFromStringValue(factoryAddress) | |
204 | 203 | ||
205 | 204 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
206 | 205 | ||
207 | 206 | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
208 | 207 | ||
209 | 208 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
210 | 209 | ||
211 | 210 | func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == 0)) | |
212 | 211 | then (stakedByUser > 0) | |
213 | 212 | else false) | |
214 | 213 | then 0 | |
215 | 214 | else if ((stakedByUser == 0)) | |
216 | 215 | then wxPerLpIntegralNew | |
217 | 216 | else if (if ((wxPerLpIntegralUserLastUpdHeightOrZero > 0)) | |
218 | 217 | then (stakedByUser > 0) | |
219 | 218 | else false) | |
220 | 219 | then getIntOrFail(this, wxPerLpIntegralUserLastKEY) | |
221 | 220 | else throw("calcWxPerLpIntegralUserLast: unexpected state") | |
222 | 221 | ||
223 | 222 | ||
224 | - | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
225 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
223 | + | func refreshPoolINTEGRALS (lpAssetIdStr,poolAddressStr,lpDeltaAmount) = { | |
226 | 224 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
227 | - | let stakedByUser = readStaked(stakedByUserKEY) | |
228 | 225 | let stakedTotal = readStaked(stakedTotalKEY) | |
229 | 226 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
230 | 227 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
231 | 228 | let MULT3 = 1000 | |
232 | - | let | |
233 | - | let | |
229 | + | let wxEmissionPerBlockX3 = (getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) * MULT3) | |
230 | + | let poolWxEmissionPerBlockX3 = fraction(wxEmissionPerBlockX3, poolWeight, (POOLWEIGHTMULT * 3)) | |
234 | 231 | let wxPerLpIntegralKEY = keyWxPerLpIntegral(lpAssetIdStr) | |
235 | 232 | let wxPerLpIntegralLastUpdHeightKEY = keyWxPerLpIntegralLastUpdHeight(lpAssetIdStr) | |
233 | + | let wxPerLpKEY = keyWxPerLp(lpAssetIdStr) | |
234 | + | let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock) | |
235 | + | let wxPerLpIntegral = getIntOrZero(this, wxPerLpIntegralKEY) | |
236 | + | let wxPerLpOrZeroX3 = 0 | |
237 | + | let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0]) | |
238 | + | let wxPerLpX3 = if ((wxPerLpOrZeroX3 != 0)) | |
239 | + | then wxPerLpOrZeroX3 | |
240 | + | else fraction(poolWxEmissionPerBlockX3, MULT8, stakedTotal) | |
241 | + | let stakedTotalNew = (stakedTotal + lpDeltaAmount) | |
242 | + | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX3 * dh)) | |
243 | + | let wxPerLpX3New = (poolWxEmissionPerBlockX3 / stakedTotalNew) | |
244 | + | let wxPerLpIntegralLastUpdHeightNew = height | |
245 | + | let debug = makeString([toString(wxPerLpIntegralNew), toString(dh), toString(wxPerLpX3), toString(stakedTotal), toString(poolWxEmissionPerBlockX3), toString(wxEmissionPerBlockX3), toString(poolWeight)], "::") | |
246 | + | $Tuple3(wxPerLpIntegralNew, [IntegerEntry(wxPerLpIntegralKEY, wxPerLpIntegralNew), IntegerEntry(wxPerLpIntegralLastUpdHeightKEY, wxPerLpIntegralLastUpdHeightNew), IntegerEntry(wxPerLpKEY, wxPerLpX3New)], debug) | |
247 | + | } | |
248 | + | ||
249 | + | ||
250 | + | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
251 | + | let $t01032310445 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
252 | + | let wxPerLpIntegralNew = $t01032310445._1 | |
253 | + | let poolIntegralSTATE = $t01032310445._2 | |
254 | + | let poolDEBUG = $t01032310445._3 | |
255 | + | let MULT3 = 1000 | |
256 | + | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
257 | + | let stakedByUser = readStaked(stakedByUserKEY) | |
236 | 258 | let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr) | |
237 | 259 | let wxPerLpIntegralUserLastUpdHeightKEY = keyWxPerLpIntegralUserLastUpdHeight(lpAssetIdStr, userAddressStr) | |
238 | - | let wxPerLpKEY = keyWxPerLp(lpAssetIdStr) | |
239 | 260 | let wxPerLpIntegralUserLastKEY = keyWxPerLpIntegralUserLast(lpAssetIdStr, userAddressStr) | |
240 | - | let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock) | |
241 | - | let wxPerLpIntegral = getIntOrZero(this, wxPerLpIntegralKEY) | |
242 | 261 | let wxToClaimUser = getIntOrZero(this, wxToClaimUserKEY) | |
243 | 262 | let wxPerLpIntegralUserLastUpdHeightOrZero = getIntOrZero(this, wxPerLpIntegralUserLastUpdHeightKEY) | |
244 | - | let wxPerLpOrZeroX8 = 0 | |
245 | - | let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0]) | |
246 | - | let wxPerLpX8 = if ((wxPerLpOrZeroX8 != 0)) | |
247 | - | then wxPerLpOrZeroX8 | |
248 | - | else fraction(poolWxEmissionPerBlock, MULT8, stakedTotal) | |
249 | - | let stakedTotalNew = (stakedTotal + lpDeltaAmount) | |
250 | - | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX8 * dh)) | |
251 | 263 | let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(stakedByUser, wxPerLpIntegralUserLastUpdHeightOrZero, wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY) | |
252 | 264 | let wxToClaimUserNew = (wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), stakedByUser, (MULT8 * MULT3))) | |
253 | 265 | let wxPerLpIntegralUserLastNew = wxPerLpIntegralNew | |
254 | - | let wxPerLpNewX8 = 0 | |
255 | - | let wxPerLpIntegralLastUpdHeightNew = height | |
256 | 266 | let wxPerLpIntegralUserLastUpdHeightNew = height | |
257 | - | let debug = makeString([toString(wxToClaimUserNew), toString( | |
258 | - | $Tuple3(wxToClaimUserNew, [ | |
267 | + | let debug = makeString([toString(wxToClaimUserNew), toString(wxPerLpIntegralUserLast), toString(stakedByUser), poolDEBUG, toString(height)], "::") | |
268 | + | $Tuple3(wxToClaimUserNew, (poolIntegralSTATE ++ [IntegerEntry(wxToClaimUserKEY, wxToClaimUserNew), IntegerEntry(wxPerLpIntegralUserLastUpdHeightKEY, wxPerLpIntegralUserLastUpdHeightNew), IntegerEntry(wxPerLpIntegralUserLastKEY, wxPerLpIntegralUserLastNew)]), debug) | |
259 | 269 | } | |
260 | 270 | ||
261 | 271 | ||
262 | 272 | @Callable(i) | |
263 | 273 | func constructor (factoryAddressStr) = if ((i.caller != this)) | |
264 | 274 | then throw("not authorized") | |
265 | 275 | else [StringEntry(keyFactoryAddress(), factoryAddressStr)] | |
266 | 276 | ||
267 | 277 | ||
268 | 278 | ||
269 | 279 | @Callable(i) | |
270 | 280 | func stake () = if ((size(i.payments) != 1)) | |
271 | 281 | then throw("invalid payment - exact one payment must be attached") | |
272 | 282 | else { | |
273 | 283 | let pmt = i.payments[0] | |
274 | 284 | let lpAssetId = value(pmt.assetId) | |
275 | 285 | let lpAssetIdStr = toBase58String(lpAssetId) | |
276 | 286 | let amount = pmt.amount | |
277 | 287 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
278 | 288 | let callerStr = toString(i.caller) | |
279 | 289 | let userAddressStr = if ((callerStr == poolAddressStr)) | |
280 | 290 | then toString(i.originCaller) | |
281 | 291 | else callerStr | |
282 | 292 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
283 | 293 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
284 | 294 | let stakedByUser = readStaked(stakedByUserKEY) | |
285 | 295 | let stakedTotal = readStaked(stakedTotalKEY) | |
286 | - | let $ | |
287 | - | let wxToClaimUserNew = $ | |
288 | - | let integralSTATE = $ | |
289 | - | let debug = $ | |
296 | + | let $t01298813105 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
297 | + | let wxToClaimUserNew = $t01298813105._1 | |
298 | + | let integralSTATE = $t01298813105._2 | |
299 | + | let debug = $t01298813105._3 | |
290 | 300 | ([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
291 | 301 | } | |
292 | 302 | ||
293 | 303 | ||
294 | 304 | ||
295 | 305 | @Callable(i) | |
296 | 306 | func unstake (lpAssetIdStr,amount) = { | |
297 | 307 | let userAddressStr = toString(i.caller) | |
298 | 308 | let lpAssetId = fromBase58String(lpAssetIdStr) | |
299 | 309 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
300 | 310 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
301 | 311 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
302 | 312 | let stakedByUser = readStaked(stakedByUserKEY) | |
303 | 313 | let stakedTotal = readStaked(stakedTotalKEY) | |
304 | - | let $ | |
305 | - | let wxToClaimUserNew = $ | |
306 | - | let integralSTATE = $ | |
307 | - | let debug = $ | |
314 | + | let $t01392214040 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount)) | |
315 | + | let wxToClaimUserNew = $t01392214040._1 | |
316 | + | let integralSTATE = $t01392214040._2 | |
317 | + | let debug = $t01392214040._3 | |
308 | 318 | if ((amount > stakedByUser)) | |
309 | 319 | then throw("passed amount is less then available") | |
310 | 320 | else ([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
311 | 321 | } | |
312 | 322 | ||
313 | 323 | ||
314 | 324 | ||
315 | 325 | @Callable(i) | |
316 | 326 | func claimWx (lpAssetIdStr) = { | |
317 | 327 | let userAddress = i.caller | |
318 | 328 | let userAddressStr = toString(i.caller) | |
319 | 329 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
320 | 330 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
321 | 331 | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
322 | 332 | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
323 | 333 | let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr) | |
324 | 334 | let claimedByUser = getIntOrZero(this, claimedByUserKEY) | |
325 | 335 | let claimedByUserMinReward = getIntOrZero(this, claimedByUserMinRewardKEY) | |
326 | 336 | let claimedByUserBoostReward = getIntOrZero(this, claimedByUserBoostRewardKEY) | |
327 | 337 | let claimedTotal = getIntOrZero(this, claimedTotalKEY) | |
328 | - | let $ | |
329 | - | let wxToClaimUserNew = $ | |
330 | - | let integralSTATE = $ | |
331 | - | let debug = $ | |
338 | + | let $t01523215344 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
339 | + | let wxToClaimUserNew = $t01523215344._1 | |
340 | + | let integralSTATE = $t01523215344._2 | |
341 | + | let debug = $t01523215344._3 | |
332 | 342 | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
333 | 343 | if ((0 >= availableToClaim)) | |
334 | 344 | then throw("nothing to claim") | |
335 | 345 | else { | |
336 | 346 | let wxAmountBoostTotal = asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]) | |
337 | - | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
338 | 347 | let minRewardPart = availableToClaim | |
339 | 348 | let boostRewardPart = min([(minRewardPart * 2), wxAmountBoostTotal]) | |
340 | 349 | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [minRewardPart], nil))[0]) | |
341 | 350 | let emitBoost = asAnyList(invoke(emissionContract, "emit", [boostRewardPart], nil)) | |
342 | 351 | if ((emitBoost == emitBoost)) | |
343 | 352 | then [IntegerEntry(claimedByUserKEY, (claimedByUser + availableToClaim)), IntegerEntry(claimedByUserMinRewardKEY, (claimedByUserMinReward + minRewardPart)), IntegerEntry(claimedByUserBoostRewardKEY, (claimedByUserBoostReward + boostRewardPart)), IntegerEntry(claimedTotalKEY, (claimedTotal + availableToClaim)), ScriptTransfer(userAddress, minRewardPart, wxAssetId), ScriptTransfer(userAddress, boostRewardPart, wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, availableToClaim, i.transactionId)] | |
344 | 353 | else throw("Strict value is not equal to itself.") | |
345 | 354 | } | |
346 | 355 | } | |
347 | 356 | ||
348 | 357 | ||
349 | 358 | ||
350 | 359 | @Callable(i) | |
351 | 360 | func claimWxREADONLY (lpAssetIdStr,userAddressStr) = { | |
352 | 361 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
353 | 362 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
354 | 363 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
355 | 364 | let stakedByUser = readStaked(stakedByUserKEY) | |
356 | 365 | let stakedTotal = readStaked(stakedTotalKEY) | |
357 | 366 | let claimedByUser = getIntOrZero(this, claimedByUserKEY) | |
358 | 367 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
359 | - | let poolWeightMult = MULT8 | |
360 | 368 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
361 | 369 | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
362 | 370 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
363 | 371 | let passedBlocks = if ((emissionStartBlock > height)) | |
364 | 372 | then 0 | |
365 | 373 | else (height - emissionStartBlock) | |
366 | - | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, | |
374 | + | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
367 | 375 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
368 | - | let $ | |
369 | - | let wxToClaimUserNew = $ | |
370 | - | let integralSTATE = $ | |
371 | - | let debug = $ | |
376 | + | let $t01754417656 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
377 | + | let wxToClaimUserNew = $t01754417656._1 | |
378 | + | let integralSTATE = $t01754417656._2 | |
379 | + | let debug = $t01754417656._3 | |
372 | 380 | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
373 | 381 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
374 | 382 | let wxAmountBoostTotal = asInt(boostInvResult[0]) | |
375 | 383 | let boostDebug = asString(boostInvResult[1]) | |
376 | 384 | let minRewardPart = availableToClaim | |
377 | 385 | let boostRewardPart = min([(minRewardPart * 2), wxAmountBoostTotal]) | |
378 | 386 | let totalReward = (minRewardPart + boostRewardPart) | |
379 | 387 | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), ((((debug + "::") + toString(userWxReward)) + "::BOOSTDEBUG::") + boostDebug)], SEP)) | |
380 | 388 | } | |
381 | 389 | ||
382 | 390 | ||
391 | + | ||
392 | + | @Callable(i) | |
393 | + | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
394 | + | then throw("permissions denied") | |
395 | + | else { | |
396 | + | let $t01853618646 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
397 | + | let wxPerLpIntegralNew = $t01853618646._1 | |
398 | + | let poolIntegralSTATE = $t01853618646._2 | |
399 | + | let poolDEBUG = $t01853618646._3 | |
400 | + | poolIntegralSTATE | |
401 | + | } | |
402 | + | ||
403 | + |
github/deemru/w8io/fabc49c 57.44 ms ◑