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