tx · GcNTymb54ZHYuWE3MUqwZHDVe7gaCGuec4MmU29E2ecg 3N9Q1fto4gNiBzBhunuF57xU7chekeJBzJb: -0.01000000 Waves 2021.11.24 14:17 [1805058] smart account 3N9Q1fto4gNiBzBhunuF57xU7chekeJBzJb > SELF 0.00000000 Waves
{ "type": 13, "id": "GcNTymb54ZHYuWE3MUqwZHDVe7gaCGuec4MmU29E2ecg", "fee": 1000000, "feeAssetId": null, "timestamp": 1637752745736, "version": 1, "sender": "3N9Q1fto4gNiBzBhunuF57xU7chekeJBzJb", "senderPublicKey": "5LCbyfeLnA6WFFq4M6L7AEzy8ktT8sL9A5JXoyuaxCCJ", "proofs": [ "kS1LNfVw7d83kuj435D3wrjteSuTkYp9YhJe2Hk5chNUPauotUrJ7Htf8ENSxRvDzdHssZ3B4mPTMVRVCzwzr5L" ], "script": "base64:AAIFAAAAAAAAABoIAhIDCgEIEgASBAoCCAESAwoBCBIECgIICAAAACcAAAAABlNDQUxFOAAAAAAAAAAACAAAAAAFTVVMVDgAAAAAAAX14QAAAAAAB1NDQUxFMTgAAAAAAAAAABIAAAAABk1VTFQxOAkAATYAAAABAA3gtrOnZAAAAAAAAANTRVACAAAAAl9fAQAAAA9nZXRTdHJpbmdPckZhaWwAAAABAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEIgAAAAEFAAAAA2tleQkAASwAAAACCQABLAAAAAICAAAAD21hbmRhdG9yeSB0aGlzLgUAAAADa2V5AgAAAA8gaXMgbm90IGRlZmluZWQBAAAAGGdldFN0cmluZ0J5QWRkcmVzc09yRmFpbAAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAKbWFuZGF0b3J5IAkABCUAAAABBQAAAAdhZGRyZXNzAgAAAAEuBQA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CZNQg==", "chainId": 84, "height": 1805058, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5xNBsHSf5W9QoN4KjxcnY2r5FHEWEDNJhvu9VHxoV5qd Next: none Diff:
Old | New | Differences | |
---|---|---|---|
11 | 11 | ||
12 | 12 | let SEP = "__" | |
13 | 13 | ||
14 | - | let POOLWEIGHTMULT = MULT8 | |
15 | - | ||
16 | - | func asAnyList (val) = match val { | |
17 | - | case valAnyLyst: List[Any] => | |
18 | - | valAnyLyst | |
19 | - | case _ => | |
20 | - | throw("fail to cast into List[Any]") | |
21 | - | } | |
22 | - | ||
23 | - | ||
24 | - | func asByteVector (val) = match val { | |
25 | - | case valBin: ByteVector => | |
26 | - | valBin | |
27 | - | case _ => | |
28 | - | throw("fail to cast into Int") | |
29 | - | } | |
30 | - | ||
31 | - | ||
32 | 14 | func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined")) | |
33 | 15 | ||
34 | 16 | ||
36 | 18 | ||
37 | 19 | ||
38 | 20 | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
39 | - | ||
40 | - | ||
41 | - | func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
42 | 21 | ||
43 | 22 | ||
44 | 23 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
115 | 94 | func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr) | |
116 | 95 | ||
117 | 96 | ||
118 | - | func keyClaimedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__claimed", userAddressStr, lpAssetIdStr], SEP) | |
119 | - | ||
120 | - | ||
121 | - | func keyClaimedTotal (lpAssetIdStr) = makeString(["%s%s%s__claimed", "total", lpAssetIdStr], SEP) | |
122 | - | ||
123 | - | ||
124 | 97 | func readStaked (key) = valueOrElse(getInteger(this, key), 0) | |
125 | - | ||
126 | - | ||
127 | - | func keyLastTotalLpBalance (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "bal"], SEP) | |
128 | - | ||
129 | - | ||
130 | - | func keyLastUserLpBalance (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "bal"], SEP) | |
131 | - | ||
132 | - | ||
133 | - | func keyTotalLpBalanceIntegral (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "balINT"], SEP) | |
134 | - | ||
135 | - | ||
136 | - | func keyUserLpBalanceIntegral (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "balINT"], SEP) | |
137 | - | ||
138 | - | ||
139 | - | func keyTotalLpBalanceIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "lastUpd"], SEP) | |
140 | - | ||
141 | - | ||
142 | - | func keyUserLpBalanceIntegralLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "lastUpd"], SEP) | |
143 | - | ||
144 | - | ||
145 | - | func keyWxPerLpIntegral (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpInt"], SEP) | |
146 | - | ||
147 | - | ||
148 | - | func keyWxPerLpIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpIntH"], SEP) | |
149 | - | ||
150 | - | ||
151 | - | func keyWxToClaimUser (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpInt"], SEP) | |
152 | - | ||
153 | - | ||
154 | - | func keyWxPerLpIntegralUserLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpIntH"], SEP) | |
155 | - | ||
156 | - | ||
157 | - | func keyWxPerLp (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLp"], SEP) | |
158 | - | ||
159 | - | ||
160 | - | func keyWxPerLpIntegralUserLast (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "uIntL"], SEP) | |
161 | 98 | ||
162 | 99 | ||
163 | 100 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
169 | 106 | func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount)) | |
170 | 107 | ||
171 | 108 | ||
172 | - | let factoryContract = readFactoryAddressOrFail() | |
173 | - | ||
174 | - | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
175 | - | ||
176 | - | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
177 | - | ||
178 | - | func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == 0)) | |
179 | - | then (stakedByUser > 0) | |
180 | - | else false) | |
181 | - | then 0 | |
182 | - | else if ((stakedByUser == 0)) | |
183 | - | then wxPerLpIntegralNew | |
184 | - | else if (if ((wxPerLpIntegralUserLastUpdHeightOrZero > 0)) | |
185 | - | then (stakedByUser > 0) | |
186 | - | else false) | |
187 | - | then getIntOrFail(this, wxPerLpIntegralUserLastKEY) | |
188 | - | else throw("calcWxPerLpIntegralUserLast: unexpected state") | |
189 | - | ||
190 | - | ||
191 | - | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
192 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
193 | - | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
194 | - | let stakedByUser = readStaked(stakedByUserKEY) | |
195 | - | let stakedTotal = readStaked(stakedTotalKEY) | |
196 | - | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
197 | - | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
198 | - | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
199 | - | let poolWxEmissionPerBlock = fraction(wxEmissionPerBlock, poolWeight, POOLWEIGHTMULT) | |
200 | - | let wxPerLpIntegralKEY = keyWxPerLpIntegral(lpAssetIdStr) | |
201 | - | let wxPerLpIntegralLastUpdHeightKEY = keyWxPerLpIntegralLastUpdHeight(lpAssetIdStr) | |
202 | - | let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr) | |
203 | - | let wxPerLpIntegralUserLastUpdHeightKEY = keyWxPerLpIntegralUserLastUpdHeight(lpAssetIdStr, userAddressStr) | |
204 | - | let wxPerLpKEY = keyWxPerLp(lpAssetIdStr) | |
205 | - | let wxPerLpIntegralUserLastKEY = keyWxPerLpIntegralUserLast(lpAssetIdStr, userAddressStr) | |
206 | - | let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock) | |
207 | - | let wxPerLpIntegral = getIntOrZero(this, wxPerLpIntegralKEY) | |
208 | - | let wxToClaimUser = getIntOrZero(this, wxToClaimUserKEY) | |
209 | - | let wxPerLpIntegralUserLastUpdHeightOrZero = getIntOrZero(this, wxPerLpIntegralUserLastUpdHeightKEY) | |
210 | - | let wxPerLpOrZero = getIntOrZero(this, wxPerLpKEY) | |
211 | - | let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0]) | |
212 | - | let wxPerLp = if ((wxPerLpOrZero != 0)) | |
213 | - | then wxPerLpOrZero | |
214 | - | else fraction(poolWxEmissionPerBlock, MULT8, stakedTotal) | |
215 | - | let stakedTotalNew = (stakedTotal + lpDeltaAmount) | |
216 | - | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLp * dh)) | |
217 | - | let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(stakedByUser, wxPerLpIntegralUserLastUpdHeightOrZero, wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY) | |
218 | - | let wxToClaimUserNew = (wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), stakedByUser, MULT8)) | |
219 | - | let wxPerLpIntegralUserLastNew = wxPerLpIntegralNew | |
220 | - | let wxPerLpNew = (poolWxEmissionPerBlock / stakedTotalNew) | |
221 | - | let wxPerLpIntegralLastUpdHeightNew = height | |
222 | - | let wxPerLpIntegralUserLastUpdHeightNew = height | |
223 | - | let debug = makeString([toString(wxToClaimUserNew), toString(wxPerLpIntegralNew), toString(wxPerLpIntegralUserLast), toString(stakedByUser), toString(dh), toString(wxPerLp), toString(stakedTotal), toString(poolWxEmissionPerBlock), toString(wxEmissionPerBlock), toString(poolWeight), toString(height)], "::") | |
224 | - | $Tuple3(wxToClaimUserNew, [IntegerEntry(wxPerLpIntegralKEY, wxPerLpIntegralNew), IntegerEntry(wxPerLpIntegralLastUpdHeightKEY, wxPerLpIntegralLastUpdHeightNew), IntegerEntry(wxToClaimUserKEY, wxToClaimUserNew), IntegerEntry(wxPerLpIntegralUserLastUpdHeightKEY, wxPerLpIntegralUserLastUpdHeightNew), IntegerEntry(wxPerLpKEY, wxPerLpNew), IntegerEntry(wxPerLpIntegralUserLastKEY, wxPerLpIntegralUserLastNew)], debug) | |
225 | - | } | |
226 | - | ||
227 | - | ||
228 | 109 | @Callable(i) | |
229 | 110 | func constructor (factoryAddressStr) = if ((i.caller != this)) | |
230 | 111 | then throw("not authorized") | |
233 | 114 | ||
234 | 115 | ||
235 | 116 | @Callable(i) | |
236 | - | func stake () = if ((size(i.payments) != 1)) | |
237 | - | then throw("invalid payment - exact one payment must be attached") | |
238 | - | else { | |
239 | - | let pmt = i.payments[0] | |
240 | - | let lpAssetId = value(pmt.assetId) | |
241 | - | let lpAssetIdStr = toBase58String(lpAssetId) | |
242 | - | let amount = pmt.amount | |
243 | - | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
244 | - | let callerStr = toString(i.caller) | |
245 | - | let userAddressStr = if ((callerStr == poolAddressStr)) | |
246 | - | then toString(i.originCaller) | |
247 | - | else callerStr | |
248 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
249 | - | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
250 | - | let stakedByUser = readStaked(stakedByUserKEY) | |
251 | - | let stakedTotal = readStaked(stakedTotalKEY) | |
252 | - | let $t01155411671 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
253 | - | let wxToClaimUserNew = $t01155411671._1 | |
254 | - | let integralSTATE = $t01155411671._2 | |
255 | - | let debug = $t01155411671._3 | |
256 | - | ([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
257 | - | } | |
258 | - | ||
259 | - | ||
260 | - | ||
261 | - | @Callable(i) | |
262 | - | func unstake (lpAssetIdStr,amount) = { | |
263 | - | let userAddressStr = toString(i.caller) | |
264 | - | let lpAssetId = fromBase58String(lpAssetIdStr) | |
265 | - | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
266 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
267 | - | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
268 | - | let stakedByUser = readStaked(stakedByUserKEY) | |
269 | - | let stakedTotal = readStaked(stakedTotalKEY) | |
270 | - | let $t01248812606 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount)) | |
271 | - | let wxToClaimUserNew = $t01248812606._1 | |
272 | - | let integralSTATE = $t01248812606._2 | |
273 | - | let debug = $t01248812606._3 | |
274 | - | if ((amount > stakedByUser)) | |
275 | - | then throw("passed amount is less then available") | |
276 | - | else ([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
277 | - | } | |
278 | - | ||
279 | - | ||
280 | - | ||
281 | - | @Callable(i) | |
282 | - | func claimWx (lpAssetIdStr) = { | |
283 | - | let userAddress = i.caller | |
284 | - | let userAddressStr = toString(i.caller) | |
285 | - | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
286 | - | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
287 | - | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
288 | - | let claimedByUser = getIntOrZero(this, claimedByUserKEY) | |
289 | - | let claimedTotal = getIntOrZero(this, claimedTotalKEY) | |
290 | - | let $t01345813570 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
291 | - | let wxToClaimUserNew = $t01345813570._1 | |
292 | - | let integralSTATE = $t01345813570._2 | |
293 | - | let debug = $t01345813570._3 | |
294 | - | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
295 | - | if ((0 >= availableToClaim)) | |
296 | - | then throw("nothing to claim") | |
117 | + | func stake () = { | |
118 | + | let factory = readFactoryAddressOrFail() | |
119 | + | if ((size(i.payments) != 1)) | |
120 | + | then throw("invalid payment - exact one payment must be attached") | |
297 | 121 | else { | |
298 | - | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [availableToClaim], nil))[0]) | |
299 | - | [IntegerEntry(claimedByUserKEY, (claimedByUser + availableToClaim)), IntegerEntry(claimedTotalKEY, (claimedTotal + availableToClaim)), ScriptTransfer(userAddress, availableToClaim, wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, availableToClaim, i.transactionId)] | |
122 | + | let pmt = i.payments[0] | |
123 | + | let lpAssetId = value(pmt.assetId) | |
124 | + | let lpAssetIdStr = toBase58String(lpAssetId) | |
125 | + | let amount = pmt.amount | |
126 | + | let lpDappStr = valueOrErrorMessage(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
127 | + | let callerStr = toString(i.caller) | |
128 | + | let userAddressStr = if ((callerStr == lpDappStr)) | |
129 | + | then toString(i.originCaller) | |
130 | + | else callerStr | |
131 | + | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
132 | + | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
133 | + | let stakedByUser = readStaked(stakedByUserKEY) | |
134 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
135 | + | [IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] | |
300 | 136 | } | |
301 | 137 | } | |
302 | 138 | ||
303 | 139 | ||
304 | 140 | ||
305 | 141 | @Callable(i) | |
306 | - | func claimWxREADONLY (lpAssetIdStr,userAddressStr) = { | |
307 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
142 | + | func unstake (lpAssetIdStr,amount) = { | |
143 | + | let factory = readFactoryAddressOrFail() | |
144 | + | let userAddressStr = toString(i.caller) | |
145 | + | let lpAssetId = fromBase58String(lpAssetIdStr) | |
146 | + | if (!(isDefined(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr))))) | |
147 | + | then throw(("unsupported lp asset " + lpAssetIdStr)) | |
148 | + | else { | |
149 | + | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
150 | + | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
151 | + | let stakedByUser = readStaked(stakedByUserKEY) | |
152 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
153 | + | if ((amount > stakedByUser)) | |
154 | + | then throw("passed amount is less then available") | |
155 | + | else [IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] | |
156 | + | } | |
157 | + | } | |
158 | + | ||
159 | + | ||
160 | + | ||
161 | + | @Callable(i) | |
162 | + | func claimWx (lpAssetIdStr) = throw("temorary disabled") | |
163 | + | ||
164 | + | ||
165 | + | ||
166 | + | @Callable(i) | |
167 | + | func claimWxREADONLY (lpAssetIdStr,userAddress) = { | |
168 | + | let factoryContract = readFactoryAddressOrFail() | |
169 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
170 | + | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
171 | + | let stakedByUserKEY = keyStakedByUser(userAddress, lpAssetIdStr) | |
308 | 172 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
309 | - | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
310 | 173 | let stakedByUser = readStaked(stakedByUserKEY) | |
311 | 174 | let stakedTotal = readStaked(stakedTotalKEY) | |
312 | - | let claimedByUser = getIntOrZero(this, claimedByUserKEY) | |
313 | 175 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
314 | 176 | let poolWeightMult = MULT8 | |
315 | 177 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
320 | 182 | else (height - emissionStartBlock) | |
321 | 183 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, poolWeightMult) | |
322 | 184 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
323 | - | let $t01523915351 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
324 | - | let wxToClaimUserNew = $t01523915351._1 | |
325 | - | let integralSTATE = $t01523915351._2 | |
326 | - | let debug = $t01523915351._3 | |
327 | - | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
328 | - | $Tuple2(nil, makeString(["%s%s%d%d%s", lpAssetIdStr, userAddressStr, toString(availableToClaim), toString(claimedByUser), ((debug + "::") + toString(userWxReward))], SEP)) | |
185 | + | $Tuple2(nil, makeString(["%s%s%d", lpAssetIdStr, userAddress, toString(userWxReward)], SEP)) | |
329 | 186 | } | |
330 | 187 | ||
331 | 188 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SCALE8 = 8 | |
5 | 5 | ||
6 | 6 | let MULT8 = 100000000 | |
7 | 7 | ||
8 | 8 | let SCALE18 = 18 | |
9 | 9 | ||
10 | 10 | let MULT18 = toBigInt(1000000000000000000) | |
11 | 11 | ||
12 | 12 | let SEP = "__" | |
13 | 13 | ||
14 | - | let POOLWEIGHTMULT = MULT8 | |
15 | - | ||
16 | - | func asAnyList (val) = match val { | |
17 | - | case valAnyLyst: List[Any] => | |
18 | - | valAnyLyst | |
19 | - | case _ => | |
20 | - | throw("fail to cast into List[Any]") | |
21 | - | } | |
22 | - | ||
23 | - | ||
24 | - | func asByteVector (val) = match val { | |
25 | - | case valBin: ByteVector => | |
26 | - | valBin | |
27 | - | case _ => | |
28 | - | throw("fail to cast into Int") | |
29 | - | } | |
30 | - | ||
31 | - | ||
32 | 14 | func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined")) | |
33 | 15 | ||
34 | 16 | ||
35 | 17 | func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
36 | 18 | ||
37 | 19 | ||
38 | 20 | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
39 | - | ||
40 | - | ||
41 | - | func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
42 | 21 | ||
43 | 22 | ||
44 | 23 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
45 | 24 | ||
46 | 25 | ||
47 | 26 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
48 | 27 | ||
49 | 28 | ||
50 | 29 | let IdxFactoryCfgStakingDapp = 1 | |
51 | 30 | ||
52 | 31 | let IdxFactoryCfgBoostingDapp = 2 | |
53 | 32 | ||
54 | 33 | let IdxFactoryCfgIdoDapp = 3 | |
55 | 34 | ||
56 | 35 | let IdxFactoryCfgTeamDapp = 4 | |
57 | 36 | ||
58 | 37 | let IdxFactoryCfgEmissionDapp = 5 | |
59 | 38 | ||
60 | 39 | let IdxFactoryCfgRestDapp = 6 | |
61 | 40 | ||
62 | 41 | let IdxFactoryCfgSlippageDapp = 7 | |
63 | 42 | ||
64 | 43 | func keyFactoryCfg () = "%s__factoryConfig" | |
65 | 44 | ||
66 | 45 | ||
67 | 46 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
68 | 47 | ||
69 | 48 | ||
70 | 49 | func keyFactoryLpList () = "%s__lpTokensList" | |
71 | 50 | ||
72 | 51 | ||
73 | 52 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
74 | 53 | ||
75 | 54 | ||
76 | 55 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
77 | 56 | ||
78 | 57 | ||
79 | 58 | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(keyFactoryAddress())) | |
80 | 59 | ||
81 | 60 | ||
82 | 61 | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
83 | 62 | ||
84 | 63 | ||
85 | 64 | func readFactoryCfgOrFail (factory) = split(getStringByAddressOrFail(factory, keyFactoryCfg()), SEP) | |
86 | 65 | ||
87 | 66 | ||
88 | 67 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
89 | 68 | ||
90 | 69 | ||
91 | 70 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
92 | 71 | ||
93 | 72 | ||
94 | 73 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
95 | 74 | ||
96 | 75 | ||
97 | 76 | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
98 | 77 | ||
99 | 78 | ||
100 | 79 | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
101 | 80 | ||
102 | 81 | ||
103 | 82 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
104 | 83 | ||
105 | 84 | ||
106 | 85 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
107 | 86 | ||
108 | 87 | ||
109 | 88 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
110 | 89 | ||
111 | 90 | ||
112 | 91 | func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP) | |
113 | 92 | ||
114 | 93 | ||
115 | 94 | func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr) | |
116 | 95 | ||
117 | 96 | ||
118 | - | func keyClaimedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__claimed", userAddressStr, lpAssetIdStr], SEP) | |
119 | - | ||
120 | - | ||
121 | - | func keyClaimedTotal (lpAssetIdStr) = makeString(["%s%s%s__claimed", "total", lpAssetIdStr], SEP) | |
122 | - | ||
123 | - | ||
124 | 97 | func readStaked (key) = valueOrElse(getInteger(this, key), 0) | |
125 | - | ||
126 | - | ||
127 | - | func keyLastTotalLpBalance (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "bal"], SEP) | |
128 | - | ||
129 | - | ||
130 | - | func keyLastUserLpBalance (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "bal"], SEP) | |
131 | - | ||
132 | - | ||
133 | - | func keyTotalLpBalanceIntegral (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "balINT"], SEP) | |
134 | - | ||
135 | - | ||
136 | - | func keyUserLpBalanceIntegral (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "balINT"], SEP) | |
137 | - | ||
138 | - | ||
139 | - | func keyTotalLpBalanceIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "lastUpd"], SEP) | |
140 | - | ||
141 | - | ||
142 | - | func keyUserLpBalanceIntegralLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "lastUpd"], SEP) | |
143 | - | ||
144 | - | ||
145 | - | func keyWxPerLpIntegral (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpInt"], SEP) | |
146 | - | ||
147 | - | ||
148 | - | func keyWxPerLpIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpIntH"], SEP) | |
149 | - | ||
150 | - | ||
151 | - | func keyWxToClaimUser (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpInt"], SEP) | |
152 | - | ||
153 | - | ||
154 | - | func keyWxPerLpIntegralUserLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpIntH"], SEP) | |
155 | - | ||
156 | - | ||
157 | - | func keyWxPerLp (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLp"], SEP) | |
158 | - | ||
159 | - | ||
160 | - | func keyWxPerLpIntegralUserLast (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "uIntL"], SEP) | |
161 | 98 | ||
162 | 99 | ||
163 | 100 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
164 | 101 | ||
165 | 102 | ||
166 | 103 | func formatHistoryRecord (userAddress,lpAssetId,type,amount) = makeString(["%s%s%s%d%d%d", userAddress, lpAssetId, type, toString(height), toString(lastBlock.timestamp), toString(amount)], SEP) | |
167 | 104 | ||
168 | 105 | ||
169 | 106 | func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount)) | |
170 | 107 | ||
171 | 108 | ||
172 | - | let factoryContract = readFactoryAddressOrFail() | |
173 | - | ||
174 | - | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
175 | - | ||
176 | - | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
177 | - | ||
178 | - | func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == 0)) | |
179 | - | then (stakedByUser > 0) | |
180 | - | else false) | |
181 | - | then 0 | |
182 | - | else if ((stakedByUser == 0)) | |
183 | - | then wxPerLpIntegralNew | |
184 | - | else if (if ((wxPerLpIntegralUserLastUpdHeightOrZero > 0)) | |
185 | - | then (stakedByUser > 0) | |
186 | - | else false) | |
187 | - | then getIntOrFail(this, wxPerLpIntegralUserLastKEY) | |
188 | - | else throw("calcWxPerLpIntegralUserLast: unexpected state") | |
189 | - | ||
190 | - | ||
191 | - | func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = { | |
192 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
193 | - | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
194 | - | let stakedByUser = readStaked(stakedByUserKEY) | |
195 | - | let stakedTotal = readStaked(stakedTotalKEY) | |
196 | - | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
197 | - | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
198 | - | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
199 | - | let poolWxEmissionPerBlock = fraction(wxEmissionPerBlock, poolWeight, POOLWEIGHTMULT) | |
200 | - | let wxPerLpIntegralKEY = keyWxPerLpIntegral(lpAssetIdStr) | |
201 | - | let wxPerLpIntegralLastUpdHeightKEY = keyWxPerLpIntegralLastUpdHeight(lpAssetIdStr) | |
202 | - | let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr) | |
203 | - | let wxPerLpIntegralUserLastUpdHeightKEY = keyWxPerLpIntegralUserLastUpdHeight(lpAssetIdStr, userAddressStr) | |
204 | - | let wxPerLpKEY = keyWxPerLp(lpAssetIdStr) | |
205 | - | let wxPerLpIntegralUserLastKEY = keyWxPerLpIntegralUserLast(lpAssetIdStr, userAddressStr) | |
206 | - | let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock) | |
207 | - | let wxPerLpIntegral = getIntOrZero(this, wxPerLpIntegralKEY) | |
208 | - | let wxToClaimUser = getIntOrZero(this, wxToClaimUserKEY) | |
209 | - | let wxPerLpIntegralUserLastUpdHeightOrZero = getIntOrZero(this, wxPerLpIntegralUserLastUpdHeightKEY) | |
210 | - | let wxPerLpOrZero = getIntOrZero(this, wxPerLpKEY) | |
211 | - | let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0]) | |
212 | - | let wxPerLp = if ((wxPerLpOrZero != 0)) | |
213 | - | then wxPerLpOrZero | |
214 | - | else fraction(poolWxEmissionPerBlock, MULT8, stakedTotal) | |
215 | - | let stakedTotalNew = (stakedTotal + lpDeltaAmount) | |
216 | - | let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLp * dh)) | |
217 | - | let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(stakedByUser, wxPerLpIntegralUserLastUpdHeightOrZero, wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY) | |
218 | - | let wxToClaimUserNew = (wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), stakedByUser, MULT8)) | |
219 | - | let wxPerLpIntegralUserLastNew = wxPerLpIntegralNew | |
220 | - | let wxPerLpNew = (poolWxEmissionPerBlock / stakedTotalNew) | |
221 | - | let wxPerLpIntegralLastUpdHeightNew = height | |
222 | - | let wxPerLpIntegralUserLastUpdHeightNew = height | |
223 | - | let debug = makeString([toString(wxToClaimUserNew), toString(wxPerLpIntegralNew), toString(wxPerLpIntegralUserLast), toString(stakedByUser), toString(dh), toString(wxPerLp), toString(stakedTotal), toString(poolWxEmissionPerBlock), toString(wxEmissionPerBlock), toString(poolWeight), toString(height)], "::") | |
224 | - | $Tuple3(wxToClaimUserNew, [IntegerEntry(wxPerLpIntegralKEY, wxPerLpIntegralNew), IntegerEntry(wxPerLpIntegralLastUpdHeightKEY, wxPerLpIntegralLastUpdHeightNew), IntegerEntry(wxToClaimUserKEY, wxToClaimUserNew), IntegerEntry(wxPerLpIntegralUserLastUpdHeightKEY, wxPerLpIntegralUserLastUpdHeightNew), IntegerEntry(wxPerLpKEY, wxPerLpNew), IntegerEntry(wxPerLpIntegralUserLastKEY, wxPerLpIntegralUserLastNew)], debug) | |
225 | - | } | |
226 | - | ||
227 | - | ||
228 | 109 | @Callable(i) | |
229 | 110 | func constructor (factoryAddressStr) = if ((i.caller != this)) | |
230 | 111 | then throw("not authorized") | |
231 | 112 | else [StringEntry(keyFactoryAddress(), factoryAddressStr)] | |
232 | 113 | ||
233 | 114 | ||
234 | 115 | ||
235 | 116 | @Callable(i) | |
236 | - | func stake () = if ((size(i.payments) != 1)) | |
237 | - | then throw("invalid payment - exact one payment must be attached") | |
238 | - | else { | |
239 | - | let pmt = i.payments[0] | |
240 | - | let lpAssetId = value(pmt.assetId) | |
241 | - | let lpAssetIdStr = toBase58String(lpAssetId) | |
242 | - | let amount = pmt.amount | |
243 | - | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
244 | - | let callerStr = toString(i.caller) | |
245 | - | let userAddressStr = if ((callerStr == poolAddressStr)) | |
246 | - | then toString(i.originCaller) | |
247 | - | else callerStr | |
248 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
249 | - | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
250 | - | let stakedByUser = readStaked(stakedByUserKEY) | |
251 | - | let stakedTotal = readStaked(stakedTotalKEY) | |
252 | - | let $t01155411671 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount) | |
253 | - | let wxToClaimUserNew = $t01155411671._1 | |
254 | - | let integralSTATE = $t01155411671._2 | |
255 | - | let debug = $t01155411671._3 | |
256 | - | ([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
257 | - | } | |
258 | - | ||
259 | - | ||
260 | - | ||
261 | - | @Callable(i) | |
262 | - | func unstake (lpAssetIdStr,amount) = { | |
263 | - | let userAddressStr = toString(i.caller) | |
264 | - | let lpAssetId = fromBase58String(lpAssetIdStr) | |
265 | - | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
266 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
267 | - | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
268 | - | let stakedByUser = readStaked(stakedByUserKEY) | |
269 | - | let stakedTotal = readStaked(stakedTotalKEY) | |
270 | - | let $t01248812606 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount)) | |
271 | - | let wxToClaimUserNew = $t01248812606._1 | |
272 | - | let integralSTATE = $t01248812606._2 | |
273 | - | let debug = $t01248812606._3 | |
274 | - | if ((amount > stakedByUser)) | |
275 | - | then throw("passed amount is less then available") | |
276 | - | else ([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE) | |
277 | - | } | |
278 | - | ||
279 | - | ||
280 | - | ||
281 | - | @Callable(i) | |
282 | - | func claimWx (lpAssetIdStr) = { | |
283 | - | let userAddress = i.caller | |
284 | - | let userAddressStr = toString(i.caller) | |
285 | - | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
286 | - | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
287 | - | let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr) | |
288 | - | let claimedByUser = getIntOrZero(this, claimedByUserKEY) | |
289 | - | let claimedTotal = getIntOrZero(this, claimedTotalKEY) | |
290 | - | let $t01345813570 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
291 | - | let wxToClaimUserNew = $t01345813570._1 | |
292 | - | let integralSTATE = $t01345813570._2 | |
293 | - | let debug = $t01345813570._3 | |
294 | - | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
295 | - | if ((0 >= availableToClaim)) | |
296 | - | then throw("nothing to claim") | |
117 | + | func stake () = { | |
118 | + | let factory = readFactoryAddressOrFail() | |
119 | + | if ((size(i.payments) != 1)) | |
120 | + | then throw("invalid payment - exact one payment must be attached") | |
297 | 121 | else { | |
298 | - | let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [availableToClaim], nil))[0]) | |
299 | - | [IntegerEntry(claimedByUserKEY, (claimedByUser + availableToClaim)), IntegerEntry(claimedTotalKEY, (claimedTotal + availableToClaim)), ScriptTransfer(userAddress, availableToClaim, wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, availableToClaim, i.transactionId)] | |
122 | + | let pmt = i.payments[0] | |
123 | + | let lpAssetId = value(pmt.assetId) | |
124 | + | let lpAssetIdStr = toBase58String(lpAssetId) | |
125 | + | let amount = pmt.amount | |
126 | + | let lpDappStr = valueOrErrorMessage(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
127 | + | let callerStr = toString(i.caller) | |
128 | + | let userAddressStr = if ((callerStr == lpDappStr)) | |
129 | + | then toString(i.originCaller) | |
130 | + | else callerStr | |
131 | + | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
132 | + | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
133 | + | let stakedByUser = readStaked(stakedByUserKEY) | |
134 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
135 | + | [IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] | |
300 | 136 | } | |
301 | 137 | } | |
302 | 138 | ||
303 | 139 | ||
304 | 140 | ||
305 | 141 | @Callable(i) | |
306 | - | func claimWxREADONLY (lpAssetIdStr,userAddressStr) = { | |
307 | - | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
142 | + | func unstake (lpAssetIdStr,amount) = { | |
143 | + | let factory = readFactoryAddressOrFail() | |
144 | + | let userAddressStr = toString(i.caller) | |
145 | + | let lpAssetId = fromBase58String(lpAssetIdStr) | |
146 | + | if (!(isDefined(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr))))) | |
147 | + | then throw(("unsupported lp asset " + lpAssetIdStr)) | |
148 | + | else { | |
149 | + | let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr) | |
150 | + | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
151 | + | let stakedByUser = readStaked(stakedByUserKEY) | |
152 | + | let stakedTotal = readStaked(stakedTotalKEY) | |
153 | + | if ((amount > stakedByUser)) | |
154 | + | then throw("passed amount is less then available") | |
155 | + | else [IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] | |
156 | + | } | |
157 | + | } | |
158 | + | ||
159 | + | ||
160 | + | ||
161 | + | @Callable(i) | |
162 | + | func claimWx (lpAssetIdStr) = throw("temorary disabled") | |
163 | + | ||
164 | + | ||
165 | + | ||
166 | + | @Callable(i) | |
167 | + | func claimWxREADONLY (lpAssetIdStr,userAddress) = { | |
168 | + | let factoryContract = readFactoryAddressOrFail() | |
169 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
170 | + | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
171 | + | let stakedByUserKEY = keyStakedByUser(userAddress, lpAssetIdStr) | |
308 | 172 | let stakedTotalKEY = keyStakedTotal(lpAssetIdStr) | |
309 | - | let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr) | |
310 | 173 | let stakedByUser = readStaked(stakedByUserKEY) | |
311 | 174 | let stakedTotal = readStaked(stakedTotalKEY) | |
312 | - | let claimedByUser = getIntOrZero(this, claimedByUserKEY) | |
313 | 175 | let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)) | |
314 | 176 | let poolWeightMult = MULT8 | |
315 | 177 | let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
316 | 178 | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
317 | 179 | let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock()) | |
318 | 180 | let passedBlocks = if ((emissionStartBlock > height)) | |
319 | 181 | then 0 | |
320 | 182 | else (height - emissionStartBlock) | |
321 | 183 | let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, poolWeightMult) | |
322 | 184 | let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal) | |
323 | - | let $t01523915351 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0) | |
324 | - | let wxToClaimUserNew = $t01523915351._1 | |
325 | - | let integralSTATE = $t01523915351._2 | |
326 | - | let debug = $t01523915351._3 | |
327 | - | let availableToClaim = (wxToClaimUserNew - claimedByUser) | |
328 | - | $Tuple2(nil, makeString(["%s%s%d%d%s", lpAssetIdStr, userAddressStr, toString(availableToClaim), toString(claimedByUser), ((debug + "::") + toString(userWxReward))], SEP)) | |
185 | + | $Tuple2(nil, makeString(["%s%s%d", lpAssetIdStr, userAddress, toString(userWxReward)], SEP)) | |
329 | 186 | } | |
330 | 187 | ||
331 | 188 |
github/deemru/w8io/169f3d6 57.87 ms ◑