tx · 2d6bLXky5ew8shWypfaoKRMWAdjLP6iYm4VAi58pCxiw 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz: -0.03500000 Waves 2022.06.29 14:05 [2117642] smart account 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz > SELF 0.00000000 Waves
{ "type": 13, "id": "2d6bLXky5ew8shWypfaoKRMWAdjLP6iYm4VAi58pCxiw", "fee": 3500000, "feeAssetId": null, "timestamp": 1656500733711, "version": 2, "chainId": 84, "sender": "3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz", "senderPublicKey": "D28XoueZWsMfm8Y5pa6C5ZFuYoWgre2Wm8tzJANJgMnq", "proofs": [ "2xAD8gG289RvjAseK661n7Vyw2qbnHZKpCbKFiVui5zDKazMP9cq1YZCkfsX43WLWyuPrQfKxsbkaJzHevjHgnez" ], "script": "base64:AAIFAAAAAAAAACcIAhIDCgEIEgMKAQgSABIAEgQKAggBEgMKAQgSBAoCCAgSBAoCCAgAAABPAAAAAAZTQ0FMRTgAAAAAAAAAAAgAAAAABU1VTFQ4AAAAAAAF9eEAAAAAAAdTQ0FMRTE4AAAAAAAAAAASAAAAAAZNVUxUMTgJAAE2AAAAAQAN4Lazp2QAAAAAAAADU0VQAgAAAAJfXwAAAAAOUE9PTFdFSUdIVE1VTFQFAAAABU1VTFQ4AQAAAAlhc0FueUxpc3QAAAABAAAAA3ZhbAQAAAAHJG1hdGNoMAUAAAADdmFsAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAlMaXN0W0FueV0EAAAACnZhbEFueUx5c3QFAAAAByRtYXRjaDAFAAAACnZhbEFueUx5c3QJAAACAAAAAQIAAAAbZmFpbCB0byBjYXN0IGludG8gTGlzdFtBbnldAQAAAAVhc0ludAAAAAEAAAADdmFsBAAAAAckbWF0Y2gwBQAAAAN2YWwDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAAGdmFsSW50BQAAAAckbWF0Y2gwBQAA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AHJG1hdGNoMAkBAAAAF21pZ3JhdG9yUHVibGljS2V5T3JVbml0AAAAAAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAACcGsFAAAAByRtYXRjaDAFAAAAAnBrAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0CAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5CQAAAgAAAAECAAAAC01hdGNoIGVycm9yAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAD3RhcmdldFB1YmxpY0tleQYJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAABFtaWdyYXRvclB1YmxpY0tleeCCKr4=", "height": 2117642, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BwbieajXhagmtA8tuBL4GTidZSsNdBzZqd7siH6gHXZe Next: EbzDBzCUkdbZn2mDaY84vdeDZ3rt6tNknu8bv1GXu6ud Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SCALE8 = 8 | |
12 | 12 | let SEP = "__" | |
13 | 13 | ||
14 | 14 | let POOLWEIGHTMULT = MULT8 | |
15 | - | ||
16 | - | let zeroBigInt = toBigInt(0) | |
17 | - | ||
18 | - | let oneBigInt = toBigInt(1) | |
19 | 15 | ||
20 | 16 | func asAnyList (val) = match val { | |
21 | 17 | case valAnyLyst: List[Any] => | |
49 | 45 | } | |
50 | 46 | ||
51 | 47 | ||
52 | - | func getStringOrFail ( | |
48 | + | func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined")) | |
53 | 49 | ||
54 | 50 | ||
55 | 51 | func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
64 | 60 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
65 | 61 | ||
66 | 62 | ||
67 | - | func getBigIntFromStringOrZero (address,key) = value(parseBigInt(valueOrElse(getString(address, key), "0"))) | |
68 | - | ||
69 | - | ||
70 | - | func getBigIntFromStringOrDefault (address,key,defaultVal) = match getString(address, key) { | |
71 | - | case s: String => | |
72 | - | value(parseBigInt(s)) | |
73 | - | case _: Unit => | |
74 | - | defaultVal | |
75 | - | case _ => | |
76 | - | throw("Match error") | |
77 | - | } | |
78 | - | ||
79 | - | ||
80 | 63 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult)) | |
81 | 64 | ||
82 | 65 | ||
84 | 67 | ||
85 | 68 | ||
86 | 69 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
87 | - | ||
88 | - | ||
89 | - | func keyVotingEmissionContract () = "%s__votingEmissionContract" | |
90 | 70 | ||
91 | 71 | ||
92 | 72 | let IdxFactoryCfgStakingDapp = 1 | |
175 | 155 | func keyClaimedByUserBoostReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedBoostReward", userAddressStr, lpAssetIdStr], SEP) | |
176 | 156 | ||
177 | 157 | ||
178 | - | func keyClaimedTotal (lpAssetIdStr) = makeString(["%s%s%s__claimed | |
158 | + | func keyClaimedTotal (lpAssetIdStr) = makeString(["%s%s%s__claimed", "total", lpAssetIdStr], SEP) | |
179 | 159 | ||
180 | 160 | ||
181 | 161 | func readStaked (key) = valueOrElse(getInteger(this, key), 0) | |
229 | 209 | func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount)) | |
230 | 210 | ||
231 | 211 | ||
232 | - | let factoryAddress = getStringOrFail( | |
212 | + | let factoryAddress = getStringOrFail(keyFactoryAddress()) | |
233 | 213 | ||
234 | 214 | let factoryContract = addressFromStringValue(factoryAddress) | |
235 | 215 | ||
239 | 219 | ||
240 | 220 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
241 | 221 | ||
242 | - | func keyNextUser (lpAssetId) = makeString(["%s%s", lpAssetId, "nextUser"], SEP) | |
243 | - | ||
244 | - | ||
245 | - | func getUsersListName (lpAssetId) = makeString(["users", lpAssetId], SEP) | |
246 | - | ||
247 | - | ||
248 | - | func keyListHead (listName) = makeString(["%s%s%s", listName, "head"], SEP) | |
249 | - | ||
250 | - | ||
251 | - | func keyListSize (listName) = makeString(["%s%s%s", listName, "size"], SEP) | |
252 | - | ||
253 | - | ||
254 | - | func keyListPrev (listName,id) = makeString(["%s%s%s%s", listName, id, "prev"], SEP) | |
255 | - | ||
256 | - | ||
257 | - | func keyListNext (listName,id) = makeString(["%s%s%s%s", listName, id, "next"], SEP) | |
258 | - | ||
259 | - | ||
260 | - | func containsNode (listName,id) = { | |
261 | - | let headOrUnit = getString(this, keyListHead(listName)) | |
262 | - | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
263 | - | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
264 | - | if (if ((id == valueOrElse(headOrUnit, ""))) | |
265 | - | then true | |
266 | - | else (prevOrUnit != unit)) | |
267 | - | then true | |
268 | - | else (nextOrUnit != unit) | |
269 | - | } | |
270 | - | ||
271 | - | ||
272 | - | func insertNodeActions (listName,id) = { | |
273 | - | let headOrUnit = getString(this, keyListHead(listName)) | |
274 | - | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
275 | - | let checkNode = if (!(containsNode(listName, id))) | |
276 | - | then true | |
277 | - | else throw("Node exists") | |
278 | - | if ((checkNode == checkNode)) | |
279 | - | then (([IntegerEntry(keyListSize(listName), (listSize + 1))] ++ (if ((headOrUnit != unit)) | |
280 | - | then [StringEntry(keyListNext(listName, id), value(headOrUnit)), StringEntry(keyListPrev(listName, value(headOrUnit)), id)] | |
281 | - | else nil)) ++ [StringEntry(keyListHead(listName), id)]) | |
282 | - | else throw("Strict value is not equal to itself.") | |
283 | - | } | |
284 | - | ||
285 | - | ||
286 | - | func deleteNodeActions (listName,id) = { | |
287 | - | let headOrUnit = getString(this, keyListHead(listName)) | |
288 | - | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
289 | - | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
290 | - | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
291 | - | ([IntegerEntry(keyListSize(listName), (listSize - 1))] ++ (if (if ((prevOrUnit != unit)) | |
292 | - | then (nextOrUnit != unit) | |
293 | - | else false) | |
294 | - | then [StringEntry(keyListNext(listName, value(prevOrUnit)), value(nextOrUnit)), StringEntry(keyListPrev(listName, value(nextOrUnit)), value(prevOrUnit)), DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, id))] | |
295 | - | else if ((nextOrUnit != unit)) | |
296 | - | then [StringEntry(keyListHead(listName), value(nextOrUnit)), DeleteEntry(keyListNext(listName, id)), DeleteEntry(keyListPrev(listName, value(nextOrUnit)))] | |
297 | - | else if ((prevOrUnit != unit)) | |
298 | - | then [DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, value(prevOrUnit)))] | |
299 | - | else if ((id == valueOrElse(headOrUnit, ""))) | |
300 | - | then [DeleteEntry(keyListHead(listName))] | |
301 | - | else throw(((("invalid node: " + listName) + ".") + id)))) | |
302 | - | } | |
303 | - | ||
304 | - | ||
305 | - | func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == zeroBigInt)) | |
306 | - | then (stakedByUser > zeroBigInt) | |
222 | + | func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == 0)) | |
223 | + | then (stakedByUser > 0) | |
307 | 224 | else false) | |
308 | - | then | |
309 | - | else if ((stakedByUser == | |
225 | + | then 0 | |
226 | + | else if ((stakedByUser == 0)) | |
310 | 227 | then wxPerLpIntegralNew | |
311 | - | else if (if ((wxPerLpIntegralUserLastUpdHeightOrZero > | |
312 | - | then (stakedByUser > | |
228 | + | else if (if ((wxPerLpIntegralUserLastUpdHeightOrZero > 0)) | |
229 | + | then (stakedByUser > 0) | |
313 | 230 | else false) | |
314 | - | then | |
231 | + | then getIntOrFail(this, wxPerLpIntegralUserLastKEY) | |
315 | 232 | else throw("calcWxPerLpIntegralUserLast: unexpected state") | |
316 | 233 | ||
317 | 234 | ||
318 | 235 | func refreshPoolINTEGRALS (lpAssetIdStr,poolAddressStr,lpDeltaAmount) = { | |
319 | 236 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
320 | - | let stakedTotal = toBigInt(readStaked(stakedTotalKEY)) | |
321 | - | let nonZeroStakedTotal = if ((stakedTotal == zeroBigInt)) | |
322 | - | then oneBigInt | |
323 | - | else stakedTotal | |
237 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
324 | 238 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
325 | 239 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
326 | 240 | let MULT3 = 1000 | |
330 | 244 | let wxPerLpIntegralLastUpdHeightKEY = keyWxPerLpIntegralLastUpdHeight(lpAssetIdStr) | |
331 | 245 | let wxPerLpKEY = keyWxPerLp(lpAssetIdStr) | |
332 | 246 | let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock) | |
333 | - | let wxPerLpIntegral = | |
247 | + | let wxPerLpIntegral = getIntOrZero(this, wxPerLpIntegralKEY) | |
334 | 248 | let wxPerLpOrZeroX3 = 0 | |
335 | 249 | let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0]) | |
336 | 250 | let wxPerLpX3 = if ((wxPerLpOrZeroX3 != 0)) | |
337 | - | then toBigInt(wxPerLpOrZeroX3) | |
338 | - | else fraction(toBigInt(poolWxEmissionPerBlockX3), toBigInt(MULT8), nonZeroStakedTotal) | |
339 | - | let stakedTotalNew = (stakedTotal + toBigInt(lpDeltaAmount)) | |
340 | - | let nonZeroStakedTotalNew = if ((stakedTotalNew == zeroBigInt)) | |
341 | - | then oneBigInt | |
342 | - | else stakedTotalNew | |
343 | - | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX3 * toBigInt(dh))) | |
344 | - | let wxPerLpX3New = (toBigInt(poolWxEmissionPerBlockX3) / nonZeroStakedTotalNew) | |
251 | + | then wxPerLpOrZeroX3 | |
252 | + | else fraction(poolWxEmissionPerBlockX3, MULT8, stakedTotal) | |
253 | + | let stakedTotalNew = (stakedTotal + lpDeltaAmount) | |
254 | + | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX3 * dh)) | |
255 | + | let wxPerLpX3New = (poolWxEmissionPerBlockX3 / stakedTotalNew) | |
345 | 256 | let wxPerLpIntegralLastUpdHeightNew = height | |
346 | - | let debug = makeString([toString(wxPerLpIntegralNew), toString(dh), toString(wxPerLpX3), toString(stakedTotal), toString(poolWxEmissionPerBlockX3), toString(wxEmissionPerBlockX3), toString(poolWeight)], "::") | |
347 | - | $Tuple3(wxPerLpIntegralNew, [ | |
257 | + | let debug = makeString([toString(wxPerLpIntegralNew), "dh=", toString(dh), "wxPerLpX3=", toString(wxPerLpX3), "stakedTotal=", toString(stakedTotal), toString(poolWxEmissionPerBlockX3), toString(wxEmissionPerBlockX3), "poolWeight=", toString(poolWeight)], "::") | |
258 | + | $Tuple3(wxPerLpIntegralNew, [IntegerEntry(wxPerLpIntegralKEY, wxPerLpIntegralNew), IntegerEntry(wxPerLpIntegralLastUpdHeightKEY, wxPerLpIntegralLastUpdHeightNew), IntegerEntry(wxPerLpKEY, wxPerLpX3New)], debug) | |
348 | 259 | } | |
349 | 260 | ||
350 | 261 | ||
351 | 262 | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
352 | - | let $ | |
353 | - | let wxPerLpIntegralNew = $ | |
354 | - | let poolIntegralSTATE = $ | |
355 | - | let poolDEBUG = $ | |
263 | + | let $t01091111033 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
264 | + | let wxPerLpIntegralNew = $t01091111033._1 | |
265 | + | let poolIntegralSTATE = $t01091111033._2 | |
266 | + | let poolDEBUG = $t01091111033._3 | |
356 | 267 | let MULT3 = 1000 | |
357 | 268 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
358 | 269 | let stakedByUser = readStaked(stakedByUserKEY) | |
359 | 270 | let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr) | |
360 | 271 | let wxPerLpIntegralUserLastUpdHeightKEY = keyWxPerLpIntegralUserLastUpdHeight(lpAssetIdStr, userAddressStr) | |
361 | 272 | let wxPerLpIntegralUserLastKEY = keyWxPerLpIntegralUserLast(lpAssetIdStr, userAddressStr) | |
362 | - | let wxToClaimUser = | |
273 | + | let wxToClaimUser = getIntOrZero(this, wxToClaimUserKEY) | |
363 | 274 | let wxPerLpIntegralUserLastUpdHeightOrZero = getIntOrZero(this, wxPerLpIntegralUserLastUpdHeightKEY) | |
364 | - | let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(toBigInt(stakedByUser), toBigInt(wxPerLpIntegralUserLastUpdHeightOrZero), wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY) | |
365 | - | let MULT11 = (MULT8 * MULT3) | |
366 | - | let wxToClaimUserNew = max([(wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), toBigInt(stakedByUser), toBigInt(MULT11))), zeroBigInt]) | |
275 | + | let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(stakedByUser, wxPerLpIntegralUserLastUpdHeightOrZero, wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY) | |
276 | + | let wxToClaimUserNew = (wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), stakedByUser, (MULT8 * MULT3))) | |
367 | 277 | let wxPerLpIntegralUserLastNew = wxPerLpIntegralNew | |
368 | 278 | let wxPerLpIntegralUserLastUpdHeightNew = height | |
369 | - | let debug = makeString([toString(wxToClaimUser), toString(wxPerLpIntegralUserLast), toString(stakedByUser), poolDEBUG, toString(height)], "::") | |
370 | - | $Tuple3(wxToClaimUserNew, (poolIntegralSTATE ++ [ | |
279 | + | let debug = makeString(["wxToClaimUser", toString(wxToClaimUser), "wxPerLpInteg", toString(wxPerLpIntegralUserLastUpdHeightOrZero), "wxPerLpIntegralNew", toString(wxPerLpIntegralNew), "wxToClaimUserNew", toString(wxToClaimUserNew), "wxPerLpIntegralUserLast", toString(wxPerLpIntegralUserLast), toString(stakedByUser), "poolDEBUG=", poolDEBUG, "height=", toString(height)], "::") | |
280 | + | $Tuple3(wxToClaimUserNew, (poolIntegralSTATE ++ [IntegerEntry(wxToClaimUserKEY, wxToClaimUserNew), IntegerEntry(wxPerLpIntegralUserLastUpdHeightKEY, wxPerLpIntegralUserLastUpdHeightNew), IntegerEntry(wxPerLpIntegralUserLastKEY, wxPerLpIntegralUserLastNew)]), debug) | |
371 | 281 | } | |
372 | 282 | ||
373 | 283 | ||
401 | 311 | } | |
402 | 312 | ||
403 | 313 | ||
404 | - | let permissionDeniedError = throw("Permission denied") | |
405 | - | ||
406 | - | func mustThis (i) = if ((i.caller == this)) | |
407 | - | then true | |
408 | - | else permissionDeniedError | |
409 | - | ||
410 | - | ||
411 | - | func mustManager (i) = match managerPublicKeyOrUnit() { | |
412 | - | case pk: ByteVector => | |
413 | - | if ((i.callerPublicKey == pk)) | |
414 | - | then true | |
415 | - | else permissionDeniedError | |
416 | - | case _: Unit => | |
417 | - | if ((i.caller == this)) | |
418 | - | then true | |
419 | - | else permissionDeniedError | |
420 | - | case _ => | |
421 | - | throw("Match error") | |
422 | - | } | |
314 | + | func mustManager (i) = { | |
315 | + | let pd = throw("Permission denied") | |
316 | + | match managerPublicKeyOrUnit() { | |
317 | + | case pk: ByteVector => | |
318 | + | if ((i.callerPublicKey == pk)) | |
319 | + | then true | |
320 | + | else pd | |
321 | + | case _: Unit => | |
322 | + | if ((i.caller == this)) | |
323 | + | then true | |
324 | + | else pd | |
325 | + | case _ => | |
326 | + | throw("Match error") | |
327 | + | } | |
328 | + | } | |
423 | 329 | ||
424 | 330 | ||
425 | 331 | @Callable(i) | |
427 | 333 | let checkCaller = mustManager(i) | |
428 | 334 | if ((checkCaller == checkCaller)) | |
429 | 335 | then [StringEntry(keyFactoryAddress(), factoryAddressStr)] | |
430 | - | else throw("Strict value is not equal to itself.") | |
431 | - | } | |
432 | - | ||
433 | - | ||
434 | - | ||
435 | - | @Callable(i) | |
436 | - | func constructorV2 (votingEmissionContract) = { | |
437 | - | let cheks = [mustManager(i), if ((addressFromString(votingEmissionContract) != unit)) | |
438 | - | then true | |
439 | - | else "invalid voting emission contract address"] | |
440 | - | if ((cheks == cheks)) | |
441 | - | then [StringEntry(keyVotingEmissionContract(), votingEmissionContract)] | |
442 | 336 | else throw("Strict value is not equal to itself.") | |
443 | 337 | } | |
444 | 338 | ||
496 | 390 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
497 | 391 | let stakedByUser = readStaked(stakedByUserKEY) | |
498 | 392 | let stakedTotal = readStaked(stakedTotalKEY) | |
499 | - | let $t01903419151 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
500 | - | let wxToClaimUserNew = $t01903419151._1 | |
501 | - | let integralSTATE = $t01903419151._2 | |
502 | - | let debug = $t01903419151._3 | |
503 | - | let listName = getUsersListName(lpAssetIdStr) | |
504 | - | let listActions = if (containsNode(listName, userAddressStr)) | |
505 | - | then nil | |
506 | - | else insertNodeActions(listName, userAddressStr) | |
507 | - | (([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
393 | + | let $t01532415441 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
394 | + | let wxToClaimUserNew = $t01532415441._1 | |
395 | + | let integralSTATE = $t01532415441._2 | |
396 | + | let debug = $t01532415441._3 | |
397 | + | ([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
508 | 398 | } | |
509 | 399 | ||
510 | 400 | ||
524 | 414 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
525 | 415 | let stakedByUser = readStaked(stakedByUserKEY) | |
526 | 416 | let stakedTotal = readStaked(stakedTotalKEY) | |
527 | - | let $t02048620604 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount)) | |
528 | - | let wxToClaimUserNew = $t02048620604._1 | |
529 | - | let integralSTATE = $t02048620604._2 | |
530 | - | let debug = $t02048620604._3 | |
531 | - | let listName = getUsersListName(lpAssetIdStr) | |
532 | - | let listActions = if (containsNode(listName, userAddressStr)) | |
533 | - | then deleteNodeActions(listName, userAddressStr) | |
534 | - | else nil | |
417 | + | let $t01657816696 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount)) | |
418 | + | let wxToClaimUserNew = $t01657816696._1 | |
419 | + | let integralSTATE = $t01657816696._2 | |
420 | + | let debug = $t01657816696._3 | |
535 | 421 | if ((amount > stakedByUser)) | |
536 | 422 | then throw("passed amount is less then available") | |
537 | - | else | |
423 | + | else ([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
538 | 424 | } | |
539 | 425 | ||
540 | 426 | ||
541 | 427 | ||
542 | 428 | @Callable(i) | |
543 | 429 | func claimWx (lpAssetIdStr) = { | |
430 | + | let userAddress = i.caller | |
544 | 431 | let userAddressStr = toString(i.caller) | |
545 | - | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr], nil) | |
546 | - | $Tuple2(nil, result) | |
547 | - | } | |
548 | - | ||
549 | - | ||
550 | - | ||
551 | - | @Callable(i) | |
552 | - | func claimWxINTERNAL (lpAssetIdStr,userAddressStr) = { | |
553 | - | let checkCaller = mustThis(i) | |
554 | - | if ((checkCaller == checkCaller)) | |
555 | - | then { | |
556 | - | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), "claimWxINTERNAL: invalid user address") | |
557 | - | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
558 | - | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
559 | - | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
560 | - | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
561 | - | let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr) | |
562 | - | let claimedByUser = getBigIntFromStringOrZero(this, claimedByUserKEY) | |
563 | - | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
564 | - | let claimedByUserBoostReward = getBigIntFromStringOrZero(this, claimedByUserBoostRewardKEY) | |
565 | - | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
566 | - | let $t02235222464 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
567 | - | let wxToClaimUserNew = $t02235222464._1 | |
568 | - | let integralSTATE = $t02235222464._2 | |
569 | - | let debug = $t02235222464._3 | |
570 | - | let availableToClaim = max([(wxToClaimUserNew - claimedByUser), zeroBigInt]) | |
571 | - | if ((zeroBigInt >= availableToClaim)) | |
572 | - | then throw("nothing to claim") | |
573 | - | else { | |
574 | - | let wxAmountBoostTotal = max([asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]), 0]) | |
575 | - | let minRewardPart = availableToClaim | |
576 | - | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
577 | - | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [toInt(minRewardPart)], nil))[0]) | |
578 | - | let emitBoost = asAnyList(invoke(emissionContract, "emit", [toInt(boostRewardPart)], nil)) | |
579 | - | if ((emitBoost == emitBoost)) | |
580 | - | then { | |
581 | - | let claimedByUserValue = (claimedByUser + availableToClaim) | |
582 | - | let claimedByUserMinRewardPlusPart = (claimedByUserMinReward + minRewardPart) | |
583 | - | let claimedByUserBoostRewardPlusBoostRewardPart = (claimedByUserMinReward + minRewardPart) | |
584 | - | let claimedTotalPlusAvailableToClaim = (claimedByUserMinReward + minRewardPart) | |
585 | - | [StringEntry(claimedByUserKEY, toString(claimedByUserValue)), StringEntry(claimedByUserMinRewardKEY, toString(claimedByUserMinRewardPlusPart)), StringEntry(claimedByUserBoostRewardKEY, toString(claimedByUserBoostRewardPlusBoostRewardPart)), StringEntry(claimedTotalKEY, toString(claimedTotalPlusAvailableToClaim)), ScriptTransfer(userAddress, toInt(minRewardPart), wxAssetId), ScriptTransfer(userAddress, toInt(boostRewardPart), wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, toInt(availableToClaim), i.transactionId)] | |
586 | - | } | |
587 | - | else throw("Strict value is not equal to itself.") | |
588 | - | } | |
432 | + | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
433 | + | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
434 | + | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
435 | + | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
436 | + | let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr) | |
437 | + | let claimedByUser = getIntOrZero(this, claimedByUserKEY) | |
438 | + | let claimedByUserMinReward = getIntOrZero(this, claimedByUserMinRewardKEY) | |
439 | + | let claimedByUserBoostReward = getIntOrZero(this, claimedByUserBoostRewardKEY) | |
440 | + | let claimedTotal = getIntOrZero(this, claimedTotalKEY) | |
441 | + | let $t01788818000 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
442 | + | let wxToClaimUserNew = $t01788818000._1 | |
443 | + | let integralSTATE = $t01788818000._2 | |
444 | + | let debug = $t01788818000._3 | |
445 | + | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
446 | + | if ((0 >= availableToClaim)) | |
447 | + | then throw("nothing to claim") | |
448 | + | else { | |
449 | + | let wxAmountBoostTotal = asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]) | |
450 | + | let minRewardPart = availableToClaim | |
451 | + | let boostRewardPart = min([(minRewardPart * 2), wxAmountBoostTotal]) | |
452 | + | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [minRewardPart], nil))[0]) | |
453 | + | let emitBoost = asAnyList(invoke(emissionContract, "emit", [boostRewardPart], nil)) | |
454 | + | if ((emitBoost == emitBoost)) | |
455 | + | 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)] | |
456 | + | else throw("Strict value is not equal to itself.") | |
589 | 457 | } | |
590 | - | else throw("Strict value is not equal to itself.") | |
591 | 458 | } | |
592 | 459 | ||
593 | 460 | ||
599 | 466 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
600 | 467 | let stakedByUser = readStaked(stakedByUserKEY) | |
601 | 468 | let stakedTotal = readStaked(stakedTotalKEY) | |
602 | - | let claimedByUser = | |
469 | + | let claimedByUser = getIntOrZero(this, claimedByUserKEY) | |
603 | 470 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
604 | 471 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
605 | 472 | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
609 | 476 | else (height - emissionStartBlock) | |
610 | 477 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
611 | 478 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
612 | - | let $ | |
613 | - | let wxToClaimUserNew = $ | |
614 | - | let integralSTATE = $ | |
615 | - | let debug = $ | |
616 | - | let availableToClaim = | |
479 | + | let $t02020120313 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
480 | + | let wxToClaimUserNew = $t02020120313._1 | |
481 | + | let integralSTATE = $t02020120313._2 | |
482 | + | let debug = $t02020120313._3 | |
483 | + | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
617 | 484 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
618 | - | let wxAmountBoostTotal = | |
485 | + | let wxAmountBoostTotal = asInt(boostInvResult[0]) | |
619 | 486 | let boostDebug = asString(boostInvResult[1]) | |
620 | 487 | let minRewardPart = availableToClaim | |
621 | - | let boostRewardPart = min([(minRewardPart * | |
488 | + | let boostRewardPart = min([(minRewardPart * 2), wxAmountBoostTotal]) | |
622 | 489 | let totalReward = (minRewardPart + boostRewardPart) | |
623 | - | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), ((((debug + "::") + toString(userWxReward)) + "::BOOST::") + boostDebug)], SEP)) | |
624 | - | } | |
625 | - | ||
626 | - | ||
627 | - | ||
628 | - | @Callable(i) | |
629 | - | func usersListTraversal (lpAssetId) = { | |
630 | - | let checkCaller = if ((toBase58String(i.caller.bytes) == valueOrElse(getString(this, keyVotingEmissionContract()), ""))) | |
631 | - | then true | |
632 | - | else mustManager(i) | |
633 | - | if ((checkCaller == checkCaller)) | |
634 | - | then { | |
635 | - | let listName = getUsersListName(lpAssetId) | |
636 | - | let userOrUnit = getString(keyNextUser(lpAssetId)) | |
637 | - | let headOrUnit = getString(keyListHead(listName)) | |
638 | - | match userOrUnit { | |
639 | - | case _: Unit => | |
640 | - | match headOrUnit { | |
641 | - | case _: Unit => | |
642 | - | $Tuple2(nil, false) | |
643 | - | case head: String => | |
644 | - | $Tuple2([StringEntry(keyNextUser(lpAssetId), head)], true) | |
645 | - | case _ => | |
646 | - | throw("Match error") | |
647 | - | } | |
648 | - | case userAddress: String => | |
649 | - | let claimedByUser = getBigIntFromStringOrZero(this, keyClaimedByUser(lpAssetId, userAddress)) | |
650 | - | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetId)) | |
651 | - | let $t02681326916 = refreshINTEGRALS(lpAssetId, userAddress, poolAddress, 0) | |
652 | - | let wxToClaimUserNew = $t02681326916._1 | |
653 | - | let integralSTATE = $t02681326916._2 | |
654 | - | let debug = $t02681326916._3 | |
655 | - | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
656 | - | let r = if ((availableToClaim > zeroBigInt)) | |
657 | - | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress], nil) | |
658 | - | else unit | |
659 | - | if ((r == r)) | |
660 | - | then { | |
661 | - | let nextUserOrUnit = getString(keyListNext(listName, userAddress)) | |
662 | - | match nextUserOrUnit { | |
663 | - | case _: Unit => | |
664 | - | $Tuple2([DeleteEntry(keyNextUser(lpAssetId))], false) | |
665 | - | case nextUser: String => | |
666 | - | $Tuple2([StringEntry(keyNextUser(lpAssetId), nextUser)], true) | |
667 | - | case _ => | |
668 | - | throw("Match error") | |
669 | - | } | |
670 | - | } | |
671 | - | else throw("Strict value is not equal to itself.") | |
672 | - | case _ => | |
673 | - | throw("Match error") | |
674 | - | } | |
675 | - | } | |
676 | - | else throw("Strict value is not equal to itself.") | |
490 | + | $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)) | |
677 | 491 | } | |
678 | 492 | ||
679 | 493 | ||
682 | 496 | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
683 | 497 | then throw("permissions denied") | |
684 | 498 | else { | |
685 | - | let $ | |
686 | - | let wxPerLpIntegralNew = $ | |
687 | - | let poolIntegralSTATE = $ | |
688 | - | let poolDEBUG = $ | |
499 | + | let $t02119321303 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
500 | + | let wxPerLpIntegralNew = $t02119321303._1 | |
501 | + | let poolIntegralSTATE = $t02119321303._2 | |
502 | + | let poolDEBUG = $t02119321303._3 | |
689 | 503 | poolIntegralSTATE | |
690 | 504 | } | |
691 | 505 |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
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 | - | ||
16 | - | let zeroBigInt = toBigInt(0) | |
17 | - | ||
18 | - | let oneBigInt = toBigInt(1) | |
19 | 15 | ||
20 | 16 | func asAnyList (val) = match val { | |
21 | 17 | case valAnyLyst: List[Any] => | |
22 | 18 | valAnyLyst | |
23 | 19 | case _ => | |
24 | 20 | throw("fail to cast into List[Any]") | |
25 | 21 | } | |
26 | 22 | ||
27 | 23 | ||
28 | 24 | func asInt (val) = match val { | |
29 | 25 | case valInt: Int => | |
30 | 26 | valInt | |
31 | 27 | case _ => | |
32 | 28 | throw("fail to cast into Int") | |
33 | 29 | } | |
34 | 30 | ||
35 | 31 | ||
36 | 32 | func asString (val) = match val { | |
37 | 33 | case valStr: String => | |
38 | 34 | valStr | |
39 | 35 | case _ => | |
40 | 36 | throw("fail to cast into Int") | |
41 | 37 | } | |
42 | 38 | ||
43 | 39 | ||
44 | 40 | func asByteVector (val) = match val { | |
45 | 41 | case valBin: ByteVector => | |
46 | 42 | valBin | |
47 | 43 | case _ => | |
48 | 44 | throw("fail to cast into Int") | |
49 | 45 | } | |
50 | 46 | ||
51 | 47 | ||
52 | - | func getStringOrFail ( | |
48 | + | func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined")) | |
53 | 49 | ||
54 | 50 | ||
55 | 51 | func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
56 | 52 | ||
57 | 53 | ||
58 | 54 | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
59 | 55 | ||
60 | 56 | ||
61 | 57 | func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
62 | 58 | ||
63 | 59 | ||
64 | 60 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
65 | 61 | ||
66 | 62 | ||
67 | - | func getBigIntFromStringOrZero (address,key) = value(parseBigInt(valueOrElse(getString(address, key), "0"))) | |
68 | - | ||
69 | - | ||
70 | - | func getBigIntFromStringOrDefault (address,key,defaultVal) = match getString(address, key) { | |
71 | - | case s: String => | |
72 | - | value(parseBigInt(s)) | |
73 | - | case _: Unit => | |
74 | - | defaultVal | |
75 | - | case _ => | |
76 | - | throw("Match error") | |
77 | - | } | |
78 | - | ||
79 | - | ||
80 | 63 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult)) | |
81 | 64 | ||
82 | 65 | ||
83 | 66 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18)) | |
84 | 67 | ||
85 | 68 | ||
86 | 69 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
87 | - | ||
88 | - | ||
89 | - | func keyVotingEmissionContract () = "%s__votingEmissionContract" | |
90 | 70 | ||
91 | 71 | ||
92 | 72 | let IdxFactoryCfgStakingDapp = 1 | |
93 | 73 | ||
94 | 74 | let IdxFactoryCfgBoostingDapp = 2 | |
95 | 75 | ||
96 | 76 | let IdxFactoryCfgIdoDapp = 3 | |
97 | 77 | ||
98 | 78 | let IdxFactoryCfgTeamDapp = 4 | |
99 | 79 | ||
100 | 80 | let IdxFactoryCfgEmissionDapp = 5 | |
101 | 81 | ||
102 | 82 | let IdxFactoryCfgRestDapp = 6 | |
103 | 83 | ||
104 | 84 | let IdxFactoryCfgSlippageDapp = 7 | |
105 | 85 | ||
106 | 86 | func keyFactoryCfg () = "%s__factoryConfig" | |
107 | 87 | ||
108 | 88 | ||
109 | 89 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
110 | 90 | ||
111 | 91 | ||
112 | 92 | func keyMigratorPublicKey () = "%s__migratorPublicKey" | |
113 | 93 | ||
114 | 94 | ||
115 | 95 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
116 | 96 | ||
117 | 97 | ||
118 | 98 | func keyStablePoolAddonAddr () = "%s__stablePoolAddonAddr" | |
119 | 99 | ||
120 | 100 | ||
121 | 101 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
122 | 102 | ||
123 | 103 | ||
124 | 104 | func keyFactoryLpList () = "%s__lpTokensList" | |
125 | 105 | ||
126 | 106 | ||
127 | 107 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
128 | 108 | ||
129 | 109 | ||
130 | 110 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
131 | 111 | ||
132 | 112 | ||
133 | 113 | func readLpList (factory) = split(valueOrElse(getString(factory, keyFactoryLpList()), ""), SEP) | |
134 | 114 | ||
135 | 115 | ||
136 | 116 | func readFactoryCfgOrFail (factory) = split(getStringByAddressOrFail(factory, keyFactoryCfg()), SEP) | |
137 | 117 | ||
138 | 118 | ||
139 | 119 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
140 | 120 | ||
141 | 121 | ||
142 | 122 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
143 | 123 | ||
144 | 124 | ||
145 | 125 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
146 | 126 | ||
147 | 127 | ||
148 | 128 | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
149 | 129 | ||
150 | 130 | ||
151 | 131 | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
152 | 132 | ||
153 | 133 | ||
154 | 134 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
155 | 135 | ||
156 | 136 | ||
157 | 137 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
158 | 138 | ||
159 | 139 | ||
160 | 140 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
161 | 141 | ||
162 | 142 | ||
163 | 143 | func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP) | |
164 | 144 | ||
165 | 145 | ||
166 | 146 | func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr) | |
167 | 147 | ||
168 | 148 | ||
169 | 149 | func keyClaimedByUser (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimed", userAddressStr, lpAssetIdStr], SEP) | |
170 | 150 | ||
171 | 151 | ||
172 | 152 | func keyClaimedByUserMinReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedMinReward", userAddressStr, lpAssetIdStr], SEP) | |
173 | 153 | ||
174 | 154 | ||
175 | 155 | func keyClaimedByUserBoostReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedBoostReward", userAddressStr, lpAssetIdStr], SEP) | |
176 | 156 | ||
177 | 157 | ||
178 | - | func keyClaimedTotal (lpAssetIdStr) = makeString(["%s%s%s__claimed | |
158 | + | func keyClaimedTotal (lpAssetIdStr) = makeString(["%s%s%s__claimed", "total", lpAssetIdStr], SEP) | |
179 | 159 | ||
180 | 160 | ||
181 | 161 | func readStaked (key) = valueOrElse(getInteger(this, key), 0) | |
182 | 162 | ||
183 | 163 | ||
184 | 164 | func keyLastTotalLpBalance (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "bal"], SEP) | |
185 | 165 | ||
186 | 166 | ||
187 | 167 | func keyLastUserLpBalance (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "bal"], SEP) | |
188 | 168 | ||
189 | 169 | ||
190 | 170 | func keyTotalLpBalanceIntegral (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "balINT"], SEP) | |
191 | 171 | ||
192 | 172 | ||
193 | 173 | func keyUserLpBalanceIntegral (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "balINT"], SEP) | |
194 | 174 | ||
195 | 175 | ||
196 | 176 | func keyTotalLpBalanceIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "lastUpd"], SEP) | |
197 | 177 | ||
198 | 178 | ||
199 | 179 | func keyUserLpBalanceIntegralLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "lastUpd"], SEP) | |
200 | 180 | ||
201 | 181 | ||
202 | 182 | func keyWxPerLpIntegral (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpInt"], SEP) | |
203 | 183 | ||
204 | 184 | ||
205 | 185 | func keyWxPerLpIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpIntH"], SEP) | |
206 | 186 | ||
207 | 187 | ||
208 | 188 | func keyWxToClaimUser (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpInt"], SEP) | |
209 | 189 | ||
210 | 190 | ||
211 | 191 | func keyWxPerLpIntegralUserLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpIntH"], SEP) | |
212 | 192 | ||
213 | 193 | ||
214 | 194 | func keyWxPerLp (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLp"], SEP) | |
215 | 195 | ||
216 | 196 | ||
217 | 197 | func keyWxPerLpX18 (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLpX18"], SEP) | |
218 | 198 | ||
219 | 199 | ||
220 | 200 | func keyWxPerLpIntegralUserLast (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "uIntL"], SEP) | |
221 | 201 | ||
222 | 202 | ||
223 | 203 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
224 | 204 | ||
225 | 205 | ||
226 | 206 | func formatHistoryRecord (userAddress,lpAssetId,type,amount) = makeString(["%s%s%s%d%d%d", userAddress, lpAssetId, type, toString(height), toString(lastBlock.timestamp), toString(amount)], SEP) | |
227 | 207 | ||
228 | 208 | ||
229 | 209 | func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount)) | |
230 | 210 | ||
231 | 211 | ||
232 | - | let factoryAddress = getStringOrFail( | |
212 | + | let factoryAddress = getStringOrFail(keyFactoryAddress()) | |
233 | 213 | ||
234 | 214 | let factoryContract = addressFromStringValue(factoryAddress) | |
235 | 215 | ||
236 | 216 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
237 | 217 | ||
238 | 218 | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
239 | 219 | ||
240 | 220 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
241 | 221 | ||
242 | - | func keyNextUser (lpAssetId) = makeString(["%s%s", lpAssetId, "nextUser"], SEP) | |
243 | - | ||
244 | - | ||
245 | - | func getUsersListName (lpAssetId) = makeString(["users", lpAssetId], SEP) | |
246 | - | ||
247 | - | ||
248 | - | func keyListHead (listName) = makeString(["%s%s%s", listName, "head"], SEP) | |
249 | - | ||
250 | - | ||
251 | - | func keyListSize (listName) = makeString(["%s%s%s", listName, "size"], SEP) | |
252 | - | ||
253 | - | ||
254 | - | func keyListPrev (listName,id) = makeString(["%s%s%s%s", listName, id, "prev"], SEP) | |
255 | - | ||
256 | - | ||
257 | - | func keyListNext (listName,id) = makeString(["%s%s%s%s", listName, id, "next"], SEP) | |
258 | - | ||
259 | - | ||
260 | - | func containsNode (listName,id) = { | |
261 | - | let headOrUnit = getString(this, keyListHead(listName)) | |
262 | - | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
263 | - | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
264 | - | if (if ((id == valueOrElse(headOrUnit, ""))) | |
265 | - | then true | |
266 | - | else (prevOrUnit != unit)) | |
267 | - | then true | |
268 | - | else (nextOrUnit != unit) | |
269 | - | } | |
270 | - | ||
271 | - | ||
272 | - | func insertNodeActions (listName,id) = { | |
273 | - | let headOrUnit = getString(this, keyListHead(listName)) | |
274 | - | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
275 | - | let checkNode = if (!(containsNode(listName, id))) | |
276 | - | then true | |
277 | - | else throw("Node exists") | |
278 | - | if ((checkNode == checkNode)) | |
279 | - | then (([IntegerEntry(keyListSize(listName), (listSize + 1))] ++ (if ((headOrUnit != unit)) | |
280 | - | then [StringEntry(keyListNext(listName, id), value(headOrUnit)), StringEntry(keyListPrev(listName, value(headOrUnit)), id)] | |
281 | - | else nil)) ++ [StringEntry(keyListHead(listName), id)]) | |
282 | - | else throw("Strict value is not equal to itself.") | |
283 | - | } | |
284 | - | ||
285 | - | ||
286 | - | func deleteNodeActions (listName,id) = { | |
287 | - | let headOrUnit = getString(this, keyListHead(listName)) | |
288 | - | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
289 | - | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
290 | - | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
291 | - | ([IntegerEntry(keyListSize(listName), (listSize - 1))] ++ (if (if ((prevOrUnit != unit)) | |
292 | - | then (nextOrUnit != unit) | |
293 | - | else false) | |
294 | - | then [StringEntry(keyListNext(listName, value(prevOrUnit)), value(nextOrUnit)), StringEntry(keyListPrev(listName, value(nextOrUnit)), value(prevOrUnit)), DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, id))] | |
295 | - | else if ((nextOrUnit != unit)) | |
296 | - | then [StringEntry(keyListHead(listName), value(nextOrUnit)), DeleteEntry(keyListNext(listName, id)), DeleteEntry(keyListPrev(listName, value(nextOrUnit)))] | |
297 | - | else if ((prevOrUnit != unit)) | |
298 | - | then [DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, value(prevOrUnit)))] | |
299 | - | else if ((id == valueOrElse(headOrUnit, ""))) | |
300 | - | then [DeleteEntry(keyListHead(listName))] | |
301 | - | else throw(((("invalid node: " + listName) + ".") + id)))) | |
302 | - | } | |
303 | - | ||
304 | - | ||
305 | - | func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == zeroBigInt)) | |
306 | - | then (stakedByUser > zeroBigInt) | |
222 | + | func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == 0)) | |
223 | + | then (stakedByUser > 0) | |
307 | 224 | else false) | |
308 | - | then | |
309 | - | else if ((stakedByUser == | |
225 | + | then 0 | |
226 | + | else if ((stakedByUser == 0)) | |
310 | 227 | then wxPerLpIntegralNew | |
311 | - | else if (if ((wxPerLpIntegralUserLastUpdHeightOrZero > | |
312 | - | then (stakedByUser > | |
228 | + | else if (if ((wxPerLpIntegralUserLastUpdHeightOrZero > 0)) | |
229 | + | then (stakedByUser > 0) | |
313 | 230 | else false) | |
314 | - | then | |
231 | + | then getIntOrFail(this, wxPerLpIntegralUserLastKEY) | |
315 | 232 | else throw("calcWxPerLpIntegralUserLast: unexpected state") | |
316 | 233 | ||
317 | 234 | ||
318 | 235 | func refreshPoolINTEGRALS (lpAssetIdStr,poolAddressStr,lpDeltaAmount) = { | |
319 | 236 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
320 | - | let stakedTotal = toBigInt(readStaked(stakedTotalKEY)) | |
321 | - | let nonZeroStakedTotal = if ((stakedTotal == zeroBigInt)) | |
322 | - | then oneBigInt | |
323 | - | else stakedTotal | |
237 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
324 | 238 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
325 | 239 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
326 | 240 | let MULT3 = 1000 | |
327 | 241 | let wxEmissionPerBlockX3 = (getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) * MULT3) | |
328 | 242 | let poolWxEmissionPerBlockX3 = fraction(wxEmissionPerBlockX3, poolWeight, (POOLWEIGHTMULT * 3)) | |
329 | 243 | let wxPerLpIntegralKEY = keyWxPerLpIntegral(lpAssetIdStr) | |
330 | 244 | let wxPerLpIntegralLastUpdHeightKEY = keyWxPerLpIntegralLastUpdHeight(lpAssetIdStr) | |
331 | 245 | let wxPerLpKEY = keyWxPerLp(lpAssetIdStr) | |
332 | 246 | let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock) | |
333 | - | let wxPerLpIntegral = | |
247 | + | let wxPerLpIntegral = getIntOrZero(this, wxPerLpIntegralKEY) | |
334 | 248 | let wxPerLpOrZeroX3 = 0 | |
335 | 249 | let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0]) | |
336 | 250 | let wxPerLpX3 = if ((wxPerLpOrZeroX3 != 0)) | |
337 | - | then toBigInt(wxPerLpOrZeroX3) | |
338 | - | else fraction(toBigInt(poolWxEmissionPerBlockX3), toBigInt(MULT8), nonZeroStakedTotal) | |
339 | - | let stakedTotalNew = (stakedTotal + toBigInt(lpDeltaAmount)) | |
340 | - | let nonZeroStakedTotalNew = if ((stakedTotalNew == zeroBigInt)) | |
341 | - | then oneBigInt | |
342 | - | else stakedTotalNew | |
343 | - | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX3 * toBigInt(dh))) | |
344 | - | let wxPerLpX3New = (toBigInt(poolWxEmissionPerBlockX3) / nonZeroStakedTotalNew) | |
251 | + | then wxPerLpOrZeroX3 | |
252 | + | else fraction(poolWxEmissionPerBlockX3, MULT8, stakedTotal) | |
253 | + | let stakedTotalNew = (stakedTotal + lpDeltaAmount) | |
254 | + | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX3 * dh)) | |
255 | + | let wxPerLpX3New = (poolWxEmissionPerBlockX3 / stakedTotalNew) | |
345 | 256 | let wxPerLpIntegralLastUpdHeightNew = height | |
346 | - | let debug = makeString([toString(wxPerLpIntegralNew), toString(dh), toString(wxPerLpX3), toString(stakedTotal), toString(poolWxEmissionPerBlockX3), toString(wxEmissionPerBlockX3), toString(poolWeight)], "::") | |
347 | - | $Tuple3(wxPerLpIntegralNew, [ | |
257 | + | let debug = makeString([toString(wxPerLpIntegralNew), "dh=", toString(dh), "wxPerLpX3=", toString(wxPerLpX3), "stakedTotal=", toString(stakedTotal), toString(poolWxEmissionPerBlockX3), toString(wxEmissionPerBlockX3), "poolWeight=", toString(poolWeight)], "::") | |
258 | + | $Tuple3(wxPerLpIntegralNew, [IntegerEntry(wxPerLpIntegralKEY, wxPerLpIntegralNew), IntegerEntry(wxPerLpIntegralLastUpdHeightKEY, wxPerLpIntegralLastUpdHeightNew), IntegerEntry(wxPerLpKEY, wxPerLpX3New)], debug) | |
348 | 259 | } | |
349 | 260 | ||
350 | 261 | ||
351 | 262 | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
352 | - | let $ | |
353 | - | let wxPerLpIntegralNew = $ | |
354 | - | let poolIntegralSTATE = $ | |
355 | - | let poolDEBUG = $ | |
263 | + | let $t01091111033 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, lpDeltaAmount) | |
264 | + | let wxPerLpIntegralNew = $t01091111033._1 | |
265 | + | let poolIntegralSTATE = $t01091111033._2 | |
266 | + | let poolDEBUG = $t01091111033._3 | |
356 | 267 | let MULT3 = 1000 | |
357 | 268 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
358 | 269 | let stakedByUser = readStaked(stakedByUserKEY) | |
359 | 270 | let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr) | |
360 | 271 | let wxPerLpIntegralUserLastUpdHeightKEY = keyWxPerLpIntegralUserLastUpdHeight(lpAssetIdStr, userAddressStr) | |
361 | 272 | let wxPerLpIntegralUserLastKEY = keyWxPerLpIntegralUserLast(lpAssetIdStr, userAddressStr) | |
362 | - | let wxToClaimUser = | |
273 | + | let wxToClaimUser = getIntOrZero(this, wxToClaimUserKEY) | |
363 | 274 | let wxPerLpIntegralUserLastUpdHeightOrZero = getIntOrZero(this, wxPerLpIntegralUserLastUpdHeightKEY) | |
364 | - | let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(toBigInt(stakedByUser), toBigInt(wxPerLpIntegralUserLastUpdHeightOrZero), wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY) | |
365 | - | let MULT11 = (MULT8 * MULT3) | |
366 | - | let wxToClaimUserNew = max([(wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), toBigInt(stakedByUser), toBigInt(MULT11))), zeroBigInt]) | |
275 | + | let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(stakedByUser, wxPerLpIntegralUserLastUpdHeightOrZero, wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY) | |
276 | + | let wxToClaimUserNew = (wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), stakedByUser, (MULT8 * MULT3))) | |
367 | 277 | let wxPerLpIntegralUserLastNew = wxPerLpIntegralNew | |
368 | 278 | let wxPerLpIntegralUserLastUpdHeightNew = height | |
369 | - | let debug = makeString([toString(wxToClaimUser), toString(wxPerLpIntegralUserLast), toString(stakedByUser), poolDEBUG, toString(height)], "::") | |
370 | - | $Tuple3(wxToClaimUserNew, (poolIntegralSTATE ++ [ | |
279 | + | let debug = makeString(["wxToClaimUser", toString(wxToClaimUser), "wxPerLpInteg", toString(wxPerLpIntegralUserLastUpdHeightOrZero), "wxPerLpIntegralNew", toString(wxPerLpIntegralNew), "wxToClaimUserNew", toString(wxToClaimUserNew), "wxPerLpIntegralUserLast", toString(wxPerLpIntegralUserLast), toString(stakedByUser), "poolDEBUG=", poolDEBUG, "height=", toString(height)], "::") | |
280 | + | $Tuple3(wxToClaimUserNew, (poolIntegralSTATE ++ [IntegerEntry(wxToClaimUserKEY, wxToClaimUserNew), IntegerEntry(wxPerLpIntegralUserLastUpdHeightKEY, wxPerLpIntegralUserLastUpdHeightNew), IntegerEntry(wxPerLpIntegralUserLastKEY, wxPerLpIntegralUserLastNew)]), debug) | |
371 | 281 | } | |
372 | 282 | ||
373 | 283 | ||
374 | 284 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
375 | 285 | case s: String => | |
376 | 286 | fromBase58String(s) | |
377 | 287 | case _: Unit => | |
378 | 288 | unit | |
379 | 289 | case _ => | |
380 | 290 | throw("Match error") | |
381 | 291 | } | |
382 | 292 | ||
383 | 293 | ||
384 | 294 | func migratorPublicKeyOrUnit () = match getString(keyMigratorPublicKey()) { | |
385 | 295 | case s: String => | |
386 | 296 | fromBase58String(s) | |
387 | 297 | case _: Unit => | |
388 | 298 | unit | |
389 | 299 | case _ => | |
390 | 300 | throw("Match error") | |
391 | 301 | } | |
392 | 302 | ||
393 | 303 | ||
394 | 304 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
395 | 305 | case s: String => | |
396 | 306 | fromBase58String(s) | |
397 | 307 | case _: Unit => | |
398 | 308 | unit | |
399 | 309 | case _ => | |
400 | 310 | throw("Match error") | |
401 | 311 | } | |
402 | 312 | ||
403 | 313 | ||
404 | - | let permissionDeniedError = throw("Permission denied") | |
405 | - | ||
406 | - | func mustThis (i) = if ((i.caller == this)) | |
407 | - | then true | |
408 | - | else permissionDeniedError | |
409 | - | ||
410 | - | ||
411 | - | func mustManager (i) = match managerPublicKeyOrUnit() { | |
412 | - | case pk: ByteVector => | |
413 | - | if ((i.callerPublicKey == pk)) | |
414 | - | then true | |
415 | - | else permissionDeniedError | |
416 | - | case _: Unit => | |
417 | - | if ((i.caller == this)) | |
418 | - | then true | |
419 | - | else permissionDeniedError | |
420 | - | case _ => | |
421 | - | throw("Match error") | |
422 | - | } | |
314 | + | func mustManager (i) = { | |
315 | + | let pd = throw("Permission denied") | |
316 | + | match managerPublicKeyOrUnit() { | |
317 | + | case pk: ByteVector => | |
318 | + | if ((i.callerPublicKey == pk)) | |
319 | + | then true | |
320 | + | else pd | |
321 | + | case _: Unit => | |
322 | + | if ((i.caller == this)) | |
323 | + | then true | |
324 | + | else pd | |
325 | + | case _ => | |
326 | + | throw("Match error") | |
327 | + | } | |
328 | + | } | |
423 | 329 | ||
424 | 330 | ||
425 | 331 | @Callable(i) | |
426 | 332 | func constructor (factoryAddressStr) = { | |
427 | 333 | let checkCaller = mustManager(i) | |
428 | 334 | if ((checkCaller == checkCaller)) | |
429 | 335 | then [StringEntry(keyFactoryAddress(), factoryAddressStr)] | |
430 | - | else throw("Strict value is not equal to itself.") | |
431 | - | } | |
432 | - | ||
433 | - | ||
434 | - | ||
435 | - | @Callable(i) | |
436 | - | func constructorV2 (votingEmissionContract) = { | |
437 | - | let cheks = [mustManager(i), if ((addressFromString(votingEmissionContract) != unit)) | |
438 | - | then true | |
439 | - | else "invalid voting emission contract address"] | |
440 | - | if ((cheks == cheks)) | |
441 | - | then [StringEntry(keyVotingEmissionContract(), votingEmissionContract)] | |
442 | 336 | else throw("Strict value is not equal to itself.") | |
443 | 337 | } | |
444 | 338 | ||
445 | 339 | ||
446 | 340 | ||
447 | 341 | @Callable(i) | |
448 | 342 | func setManager (pendingManagerPublicKey) = { | |
449 | 343 | let checkCaller = mustManager(i) | |
450 | 344 | if ((checkCaller == checkCaller)) | |
451 | 345 | then { | |
452 | 346 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
453 | 347 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
454 | 348 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
455 | 349 | else throw("Strict value is not equal to itself.") | |
456 | 350 | } | |
457 | 351 | else throw("Strict value is not equal to itself.") | |
458 | 352 | } | |
459 | 353 | ||
460 | 354 | ||
461 | 355 | ||
462 | 356 | @Callable(i) | |
463 | 357 | func confirmManager () = { | |
464 | 358 | let pm = pendingManagerPublicKeyOrUnit() | |
465 | 359 | let hasPM = if (isDefined(pm)) | |
466 | 360 | then true | |
467 | 361 | else throw("No pending manager") | |
468 | 362 | if ((hasPM == hasPM)) | |
469 | 363 | then { | |
470 | 364 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
471 | 365 | then true | |
472 | 366 | else throw("You are not pending manager") | |
473 | 367 | if ((checkPM == checkPM)) | |
474 | 368 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
475 | 369 | else throw("Strict value is not equal to itself.") | |
476 | 370 | } | |
477 | 371 | else throw("Strict value is not equal to itself.") | |
478 | 372 | } | |
479 | 373 | ||
480 | 374 | ||
481 | 375 | ||
482 | 376 | @Callable(i) | |
483 | 377 | func stake () = if ((size(i.payments) != 1)) | |
484 | 378 | then throw("invalid payment - exact one payment must be attached") | |
485 | 379 | else { | |
486 | 380 | let pmt = i.payments[0] | |
487 | 381 | let lpAssetId = value(pmt.assetId) | |
488 | 382 | let lpAssetIdStr = toBase58String(lpAssetId) | |
489 | 383 | let amount = pmt.amount | |
490 | 384 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
491 | 385 | let callerStr = toString(i.caller) | |
492 | 386 | let userAddressStr = if ((callerStr == poolAddressStr)) | |
493 | 387 | then toString(i.originCaller) | |
494 | 388 | else callerStr | |
495 | 389 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
496 | 390 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
497 | 391 | let stakedByUser = readStaked(stakedByUserKEY) | |
498 | 392 | let stakedTotal = readStaked(stakedTotalKEY) | |
499 | - | let $t01903419151 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
500 | - | let wxToClaimUserNew = $t01903419151._1 | |
501 | - | let integralSTATE = $t01903419151._2 | |
502 | - | let debug = $t01903419151._3 | |
503 | - | let listName = getUsersListName(lpAssetIdStr) | |
504 | - | let listActions = if (containsNode(listName, userAddressStr)) | |
505 | - | then nil | |
506 | - | else insertNodeActions(listName, userAddressStr) | |
507 | - | (([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) ++ listActions) | |
393 | + | let $t01532415441 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
394 | + | let wxToClaimUserNew = $t01532415441._1 | |
395 | + | let integralSTATE = $t01532415441._2 | |
396 | + | let debug = $t01532415441._3 | |
397 | + | ([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
508 | 398 | } | |
509 | 399 | ||
510 | 400 | ||
511 | 401 | ||
512 | 402 | @Callable(i) | |
513 | 403 | func unstake (lpAssetIdStr,amount) = { | |
514 | 404 | let lpAssetId = fromBase58String(lpAssetIdStr) | |
515 | 405 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
516 | 406 | let poolAddon = valueOrElse(getString(this, keyStablePoolAddonAddr()), poolAddressStr) | |
517 | 407 | let callerStr = toString(i.caller) | |
518 | 408 | let userAddressStr = if (if ((callerStr == poolAddressStr)) | |
519 | 409 | then true | |
520 | 410 | else (callerStr == poolAddon)) | |
521 | 411 | then toString(i.originCaller) | |
522 | 412 | else callerStr | |
523 | 413 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
524 | 414 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
525 | 415 | let stakedByUser = readStaked(stakedByUserKEY) | |
526 | 416 | let stakedTotal = readStaked(stakedTotalKEY) | |
527 | - | let $t02048620604 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount)) | |
528 | - | let wxToClaimUserNew = $t02048620604._1 | |
529 | - | let integralSTATE = $t02048620604._2 | |
530 | - | let debug = $t02048620604._3 | |
531 | - | let listName = getUsersListName(lpAssetIdStr) | |
532 | - | let listActions = if (containsNode(listName, userAddressStr)) | |
533 | - | then deleteNodeActions(listName, userAddressStr) | |
534 | - | else nil | |
417 | + | let $t01657816696 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount)) | |
418 | + | let wxToClaimUserNew = $t01657816696._1 | |
419 | + | let integralSTATE = $t01657816696._2 | |
420 | + | let debug = $t01657816696._3 | |
535 | 421 | if ((amount > stakedByUser)) | |
536 | 422 | then throw("passed amount is less then available") | |
537 | - | else | |
423 | + | else ([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
538 | 424 | } | |
539 | 425 | ||
540 | 426 | ||
541 | 427 | ||
542 | 428 | @Callable(i) | |
543 | 429 | func claimWx (lpAssetIdStr) = { | |
430 | + | let userAddress = i.caller | |
544 | 431 | let userAddressStr = toString(i.caller) | |
545 | - | let result = invoke(this, "claimWxINTERNAL", [lpAssetIdStr, userAddressStr], nil) | |
546 | - | $Tuple2(nil, result) | |
547 | - | } | |
548 | - | ||
549 | - | ||
550 | - | ||
551 | - | @Callable(i) | |
552 | - | func claimWxINTERNAL (lpAssetIdStr,userAddressStr) = { | |
553 | - | let checkCaller = mustThis(i) | |
554 | - | if ((checkCaller == checkCaller)) | |
555 | - | then { | |
556 | - | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), "claimWxINTERNAL: invalid user address") | |
557 | - | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
558 | - | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
559 | - | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
560 | - | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
561 | - | let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr) | |
562 | - | let claimedByUser = getBigIntFromStringOrZero(this, claimedByUserKEY) | |
563 | - | let claimedByUserMinReward = getBigIntFromStringOrZero(this, claimedByUserMinRewardKEY) | |
564 | - | let claimedByUserBoostReward = getBigIntFromStringOrZero(this, claimedByUserBoostRewardKEY) | |
565 | - | let claimedTotal = getBigIntFromStringOrZero(this, claimedTotalKEY) | |
566 | - | let $t02235222464 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
567 | - | let wxToClaimUserNew = $t02235222464._1 | |
568 | - | let integralSTATE = $t02235222464._2 | |
569 | - | let debug = $t02235222464._3 | |
570 | - | let availableToClaim = max([(wxToClaimUserNew - claimedByUser), zeroBigInt]) | |
571 | - | if ((zeroBigInt >= availableToClaim)) | |
572 | - | then throw("nothing to claim") | |
573 | - | else { | |
574 | - | let wxAmountBoostTotal = max([asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]), 0]) | |
575 | - | let minRewardPart = availableToClaim | |
576 | - | let boostRewardPart = min([(minRewardPart * toBigInt(2)), toBigInt(wxAmountBoostTotal)]) | |
577 | - | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [toInt(minRewardPart)], nil))[0]) | |
578 | - | let emitBoost = asAnyList(invoke(emissionContract, "emit", [toInt(boostRewardPart)], nil)) | |
579 | - | if ((emitBoost == emitBoost)) | |
580 | - | then { | |
581 | - | let claimedByUserValue = (claimedByUser + availableToClaim) | |
582 | - | let claimedByUserMinRewardPlusPart = (claimedByUserMinReward + minRewardPart) | |
583 | - | let claimedByUserBoostRewardPlusBoostRewardPart = (claimedByUserMinReward + minRewardPart) | |
584 | - | let claimedTotalPlusAvailableToClaim = (claimedByUserMinReward + minRewardPart) | |
585 | - | [StringEntry(claimedByUserKEY, toString(claimedByUserValue)), StringEntry(claimedByUserMinRewardKEY, toString(claimedByUserMinRewardPlusPart)), StringEntry(claimedByUserBoostRewardKEY, toString(claimedByUserBoostRewardPlusBoostRewardPart)), StringEntry(claimedTotalKEY, toString(claimedTotalPlusAvailableToClaim)), ScriptTransfer(userAddress, toInt(minRewardPart), wxAssetId), ScriptTransfer(userAddress, toInt(boostRewardPart), wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, toInt(availableToClaim), i.transactionId)] | |
586 | - | } | |
587 | - | else throw("Strict value is not equal to itself.") | |
588 | - | } | |
432 | + | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
433 | + | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
434 | + | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
435 | + | let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr) | |
436 | + | let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr) | |
437 | + | let claimedByUser = getIntOrZero(this, claimedByUserKEY) | |
438 | + | let claimedByUserMinReward = getIntOrZero(this, claimedByUserMinRewardKEY) | |
439 | + | let claimedByUserBoostReward = getIntOrZero(this, claimedByUserBoostRewardKEY) | |
440 | + | let claimedTotal = getIntOrZero(this, claimedTotalKEY) | |
441 | + | let $t01788818000 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
442 | + | let wxToClaimUserNew = $t01788818000._1 | |
443 | + | let integralSTATE = $t01788818000._2 | |
444 | + | let debug = $t01788818000._3 | |
445 | + | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
446 | + | if ((0 >= availableToClaim)) | |
447 | + | then throw("nothing to claim") | |
448 | + | else { | |
449 | + | let wxAmountBoostTotal = asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0]) | |
450 | + | let minRewardPart = availableToClaim | |
451 | + | let boostRewardPart = min([(minRewardPart * 2), wxAmountBoostTotal]) | |
452 | + | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [minRewardPart], nil))[0]) | |
453 | + | let emitBoost = asAnyList(invoke(emissionContract, "emit", [boostRewardPart], nil)) | |
454 | + | if ((emitBoost == emitBoost)) | |
455 | + | 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)] | |
456 | + | else throw("Strict value is not equal to itself.") | |
589 | 457 | } | |
590 | - | else throw("Strict value is not equal to itself.") | |
591 | 458 | } | |
592 | 459 | ||
593 | 460 | ||
594 | 461 | ||
595 | 462 | @Callable(i) | |
596 | 463 | func claimWxREADONLY (lpAssetIdStr,userAddressStr) = { | |
597 | 464 | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
598 | 465 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
599 | 466 | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
600 | 467 | let stakedByUser = readStaked(stakedByUserKEY) | |
601 | 468 | let stakedTotal = readStaked(stakedTotalKEY) | |
602 | - | let claimedByUser = | |
469 | + | let claimedByUser = getIntOrZero(this, claimedByUserKEY) | |
603 | 470 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
604 | 471 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
605 | 472 | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
606 | 473 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
607 | 474 | let passedBlocks = if ((emissionStartBlock > height)) | |
608 | 475 | then 0 | |
609 | 476 | else (height - emissionStartBlock) | |
610 | 477 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, POOLWEIGHTMULT) | |
611 | 478 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
612 | - | let $ | |
613 | - | let wxToClaimUserNew = $ | |
614 | - | let integralSTATE = $ | |
615 | - | let debug = $ | |
616 | - | let availableToClaim = | |
479 | + | let $t02020120313 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
480 | + | let wxToClaimUserNew = $t02020120313._1 | |
481 | + | let integralSTATE = $t02020120313._2 | |
482 | + | let debug = $t02020120313._3 | |
483 | + | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
617 | 484 | let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil)) | |
618 | - | let wxAmountBoostTotal = | |
485 | + | let wxAmountBoostTotal = asInt(boostInvResult[0]) | |
619 | 486 | let boostDebug = asString(boostInvResult[1]) | |
620 | 487 | let minRewardPart = availableToClaim | |
621 | - | let boostRewardPart = min([(minRewardPart * | |
488 | + | let boostRewardPart = min([(minRewardPart * 2), wxAmountBoostTotal]) | |
622 | 489 | let totalReward = (minRewardPart + boostRewardPart) | |
623 | - | $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), ((((debug + "::") + toString(userWxReward)) + "::BOOST::") + boostDebug)], SEP)) | |
624 | - | } | |
625 | - | ||
626 | - | ||
627 | - | ||
628 | - | @Callable(i) | |
629 | - | func usersListTraversal (lpAssetId) = { | |
630 | - | let checkCaller = if ((toBase58String(i.caller.bytes) == valueOrElse(getString(this, keyVotingEmissionContract()), ""))) | |
631 | - | then true | |
632 | - | else mustManager(i) | |
633 | - | if ((checkCaller == checkCaller)) | |
634 | - | then { | |
635 | - | let listName = getUsersListName(lpAssetId) | |
636 | - | let userOrUnit = getString(keyNextUser(lpAssetId)) | |
637 | - | let headOrUnit = getString(keyListHead(listName)) | |
638 | - | match userOrUnit { | |
639 | - | case _: Unit => | |
640 | - | match headOrUnit { | |
641 | - | case _: Unit => | |
642 | - | $Tuple2(nil, false) | |
643 | - | case head: String => | |
644 | - | $Tuple2([StringEntry(keyNextUser(lpAssetId), head)], true) | |
645 | - | case _ => | |
646 | - | throw("Match error") | |
647 | - | } | |
648 | - | case userAddress: String => | |
649 | - | let claimedByUser = getBigIntFromStringOrZero(this, keyClaimedByUser(lpAssetId, userAddress)) | |
650 | - | let poolAddress = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetId)) | |
651 | - | let $t02681326916 = refreshINTEGRALS(lpAssetId, userAddress, poolAddress, 0) | |
652 | - | let wxToClaimUserNew = $t02681326916._1 | |
653 | - | let integralSTATE = $t02681326916._2 | |
654 | - | let debug = $t02681326916._3 | |
655 | - | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
656 | - | let r = if ((availableToClaim > zeroBigInt)) | |
657 | - | then invoke(this, "claimWxINTERNAL", [lpAssetId, userAddress], nil) | |
658 | - | else unit | |
659 | - | if ((r == r)) | |
660 | - | then { | |
661 | - | let nextUserOrUnit = getString(keyListNext(listName, userAddress)) | |
662 | - | match nextUserOrUnit { | |
663 | - | case _: Unit => | |
664 | - | $Tuple2([DeleteEntry(keyNextUser(lpAssetId))], false) | |
665 | - | case nextUser: String => | |
666 | - | $Tuple2([StringEntry(keyNextUser(lpAssetId), nextUser)], true) | |
667 | - | case _ => | |
668 | - | throw("Match error") | |
669 | - | } | |
670 | - | } | |
671 | - | else throw("Strict value is not equal to itself.") | |
672 | - | case _ => | |
673 | - | throw("Match error") | |
674 | - | } | |
675 | - | } | |
676 | - | else throw("Strict value is not equal to itself.") | |
490 | + | $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)) | |
677 | 491 | } | |
678 | 492 | ||
679 | 493 | ||
680 | 494 | ||
681 | 495 | @Callable(i) | |
682 | 496 | func onModifyWeight (lpAssetIdStr,poolAddressStr) = if ((i.caller != factoryContract)) | |
683 | 497 | then throw("permissions denied") | |
684 | 498 | else { | |
685 | - | let $ | |
686 | - | let wxPerLpIntegralNew = $ | |
687 | - | let poolIntegralSTATE = $ | |
688 | - | let poolDEBUG = $ | |
499 | + | let $t02119321303 = refreshPoolINTEGRALS(lpAssetIdStr, poolAddressStr, 0) | |
500 | + | let wxPerLpIntegralNew = $t02119321303._1 | |
501 | + | let poolIntegralSTATE = $t02119321303._2 | |
502 | + | let poolDEBUG = $t02119321303._3 | |
689 | 503 | poolIntegralSTATE | |
690 | 504 | } | |
691 | 505 | ||
692 | 506 | ||
693 | 507 | @Verifier(tx) | |
694 | 508 | func verify () = { | |
695 | 509 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
696 | 510 | case pk: ByteVector => | |
697 | 511 | pk | |
698 | 512 | case _: Unit => | |
699 | 513 | tx.senderPublicKey | |
700 | 514 | case _ => | |
701 | 515 | throw("Match error") | |
702 | 516 | } | |
703 | 517 | let migratorPublicKey = match migratorPublicKeyOrUnit() { | |
704 | 518 | case pk: ByteVector => | |
705 | 519 | pk | |
706 | 520 | case _: Unit => | |
707 | 521 | tx.senderPublicKey | |
708 | 522 | case _ => | |
709 | 523 | throw("Match error") | |
710 | 524 | } | |
711 | 525 | if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)) | |
712 | 526 | then true | |
713 | 527 | else sigVerify(tx.bodyBytes, tx.proofs[0], migratorPublicKey) | |
714 | 528 | } | |
715 | 529 |
github/deemru/w8io/026f985 99.39 ms ◑