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