tx · 5jidqWrt7rGEaTKVwGcL6z6AkvG3YdQYnQQyp4G6fYxu

3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz:  -0.01000000 Waves

2021.12.14 19:06 [1834145] smart account 3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz > SELF 0.00000000 Waves

{ "type": 13, "id": "5jidqWrt7rGEaTKVwGcL6z6AkvG3YdQYnQQyp4G6fYxu", "fee": 1000000, "feeAssetId": null, "timestamp": 1639498030363, "version": 1, "sender": "3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz", "senderPublicKey": "D28XoueZWsMfm8Y5pa6C5ZFuYoWgre2Wm8tzJANJgMnq", "proofs": [ "wMLMsquHr2bsSh2AJvDh2J2APA6auLtvv1vVzuH9ndhH5xf3mXq9RS67z4KwWU5NDRduvawmkCs1efbYjp4Aqft" ], "script": "base64:AAIFAAAAAAAAABoIAhIDCgEIEgASBAoCCAESAwoBCBIECgIICAAAAEYAAAAABlNDQUxFOAAAAAAAAAAACAAAAAAFTVVMVDgAAAAAAAX14QAAAAAAB1NDQUxFMTgAAAAAAAAAABIAAAAABk1VTFQxOAkAATYAAAABAA3gtrOnZAAAAAAAAANTRVACAAAAAl9fAAAAAA5QT09MV0VJR0hUTVVMVAUAAAAFTVVMVDgBAAAACWFzQW55TGlzdAAAAAEAAAADdmFsBAAAAAckbWF0Y2gwBQAAAAN2YWwDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACUxpc3RbQW55XQQAAAAKdmFsQW55THlzdAUAAAAHJG1hdGNoMAUAAAAKdmFsQW55THlzdAkAAAIAAAABAgAAABtmYWlsIHRvIGNhc3QgaW50byBMaXN0W0FueV0BAAAABWFzSW50AAAAAQAAAAN2YWwEAAAAByRtYXRjaDAFAAAAA3ZhbAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAZ2YWxJbnQFAAAAByRtYXRjaDAFAAAABnZhbEludAkAAAIAAAABAgAAABVmYWlsI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kAAAAAQUAAAANY2xhaW1lZEJ5VXNlcgkABEwAAAACCQABpAAAAAEFAAAADW1pblJld2FyZFBhcnQJAARMAAAAAgkAAaQAAAABBQAAAA9ib29zdFJld2FyZFBhcnQJAARMAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAAVkZWJ1ZwIAAAACOjoJAAGkAAAAAQUAAAAMdXNlcld4UmV3YXJkAgAAAA46OkJPT1NUREVCVUc6OgUAAAAKYm9vc3REZWJ1ZwUAAAADbmlsBQAAAANTRVAAAAAA09EsMQ==", "chainId": 84, "height": 1834145, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EJNQTys9JrrnFxg7DiBRJL5ZrXigdw2Br7Xe4RJshW2Q Next: mq3BN61DGfVzK9yG6hf6GknxbjTvw7T2mHhWrPBoeaQ Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let SCALE8 = 8
5+
6+let MULT8 = 100000000
7+
8+let SCALE18 = 18
9+
10+let MULT18 = toBigInt(1000000000000000000)
11+
412 let SEP = "__"
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 asInt (val) = match val {
25+ case valInt: Int =>
26+ valInt
27+ case _ =>
28+ throw("fail to cast into Int")
29+}
30+
31+
32+func asString (val) = match val {
33+ case valStr: String =>
34+ valStr
35+ case _ =>
36+ throw("fail to cast into Int")
37+}
38+
39+
40+func asByteVector (val) = match val {
41+ case valBin: ByteVector =>
42+ valBin
43+ case _ =>
44+ throw("fail to cast into Int")
45+}
46+
547
648 func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined"))
749
951 func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined"))
1052
1153
54+func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0)
55+
56+
57+func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal)
58+
59+
60+func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined"))
61+
62+
63+func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult))
64+
65+
66+func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18))
67+
68+
1269 func keyFactoryAddress () = "%s%s__config__factoryAddress"
70+
71+
72+let IdxFactoryCfgStakingDapp = 1
73+
74+let IdxFactoryCfgBoostingDapp = 2
75+
76+let IdxFactoryCfgIdoDapp = 3
77+
78+let IdxFactoryCfgTeamDapp = 4
79+
80+let IdxFactoryCfgEmissionDapp = 5
81+
82+let IdxFactoryCfgRestDapp = 6
83+
84+let IdxFactoryCfgSlippageDapp = 7
85+
86+func keyFactoryCfg () = "%s__factoryConfig"
1387
1488
1589 func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
1690
1791
92+func keyFactoryLpList () = "%s__lpTokensList"
93+
94+
95+func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
96+
97+
98+func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
99+
100+
18101 func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(keyFactoryAddress()))
102+
103+
104+func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP)
105+
106+
107+func readFactoryCfgOrFail (factory) = split(getStringByAddressOrFail(factory, keyFactoryCfg()), SEP)
108+
109+
110+func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp])
111+
112+
113+func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp])
114+
115+
116+func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp])
117+
118+
119+func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
120+
121+
122+func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current"
123+
124+
125+func keyEmissionStartBlock () = "%s%s__emission__startBlock"
126+
127+
128+func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
129+
130+
131+func keyEmissionEndBlock () = "%s%s__emission__endBlock"
19132
20133
21134 func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP)
24137 func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr)
25138
26139
140+func keyClaimedByUser (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimed", userAddressStr, lpAssetIdStr], SEP)
141+
142+
143+func keyClaimedByUserMinReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedMinReward", userAddressStr, lpAssetIdStr], SEP)
144+
145+
146+func keyClaimedByUserBoostReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedBoostReward", userAddressStr, lpAssetIdStr], SEP)
147+
148+
149+func keyClaimedTotal (lpAssetIdStr) = makeString(["%s%s%s__claimed", "total", lpAssetIdStr], SEP)
150+
151+
27152 func readStaked (key) = valueOrElse(getInteger(this, key), 0)
153+
154+
155+func keyLastTotalLpBalance (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "bal"], SEP)
156+
157+
158+func keyLastUserLpBalance (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "bal"], SEP)
159+
160+
161+func keyTotalLpBalanceIntegral (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "balINT"], SEP)
162+
163+
164+func keyUserLpBalanceIntegral (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "balINT"], SEP)
165+
166+
167+func keyTotalLpBalanceIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "lastUpd"], SEP)
168+
169+
170+func keyUserLpBalanceIntegralLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "lastUpd"], SEP)
171+
172+
173+func keyWxPerLpIntegral (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpInt"], SEP)
174+
175+
176+func keyWxPerLpIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpIntH"], SEP)
177+
178+
179+func keyWxToClaimUser (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpInt"], SEP)
180+
181+
182+func keyWxPerLpIntegralUserLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpIntH"], SEP)
183+
184+
185+func keyWxPerLp (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLp"], SEP)
186+
187+
188+func keyWxPerLpX18 (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLpX18"], SEP)
189+
190+
191+func keyWxPerLpIntegralUserLast (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "uIntL"], SEP)
28192
29193
30194 func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP)
36200 func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount))
37201
38202
203+let factoryContract = readFactoryAddressOrFail()
204+
205+let factoryCfg = readFactoryCfgOrFail(factoryContract)
206+
207+let emissionContract = getEmissionAddressOrFail(factoryCfg)
208+
209+let boostingContract = getBoostingAddressOrFail(factoryCfg)
210+
211+func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == 0))
212+ then (stakedByUser > 0)
213+ else false)
214+ then 0
215+ else if ((stakedByUser == 0))
216+ then wxPerLpIntegralNew
217+ else if (if ((wxPerLpIntegralUserLastUpdHeightOrZero > 0))
218+ then (stakedByUser > 0)
219+ else false)
220+ then getIntOrFail(this, wxPerLpIntegralUserLastKEY)
221+ else throw("calcWxPerLpIntegralUserLast: unexpected state")
222+
223+
224+func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = {
225+ let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
226+ let stakedTotalKEY = keyStakedTotal(lpAssetIdStr)
227+ let stakedByUser = readStaked(stakedByUserKEY)
228+ let stakedTotal = readStaked(stakedTotalKEY)
229+ let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
230+ let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock())
231+ let MULT3 = 1000
232+ let wxEmissionPerBlock = (getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) * MULT3)
233+ let poolWxEmissionPerBlock = fraction(wxEmissionPerBlock, poolWeight, (POOLWEIGHTMULT * 3))
234+ let wxPerLpIntegralKEY = keyWxPerLpIntegral(lpAssetIdStr)
235+ let wxPerLpIntegralLastUpdHeightKEY = keyWxPerLpIntegralLastUpdHeight(lpAssetIdStr)
236+ let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr)
237+ let wxPerLpIntegralUserLastUpdHeightKEY = keyWxPerLpIntegralUserLastUpdHeight(lpAssetIdStr, userAddressStr)
238+ let wxPerLpKEY = keyWxPerLp(lpAssetIdStr)
239+ let wxPerLpIntegralUserLastKEY = keyWxPerLpIntegralUserLast(lpAssetIdStr, userAddressStr)
240+ let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock)
241+ let wxPerLpIntegral = getIntOrZero(this, wxPerLpIntegralKEY)
242+ let wxToClaimUser = getIntOrZero(this, wxToClaimUserKEY)
243+ let wxPerLpIntegralUserLastUpdHeightOrZero = getIntOrZero(this, wxPerLpIntegralUserLastUpdHeightKEY)
244+ let wxPerLpOrZeroX8 = getIntOrZero(this, wxPerLpKEY)
245+ let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0])
246+ let wxPerLpX8 = if ((wxPerLpOrZeroX8 != 0))
247+ then wxPerLpOrZeroX8
248+ else fraction(poolWxEmissionPerBlock, MULT8, stakedTotal)
249+ let stakedTotalNew = (stakedTotal + lpDeltaAmount)
250+ let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX8 * dh))
251+ let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(stakedByUser, wxPerLpIntegralUserLastUpdHeightOrZero, wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY)
252+ let wxToClaimUserNew = (wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), stakedByUser, (MULT8 * MULT3)))
253+ let wxPerLpIntegralUserLastNew = wxPerLpIntegralNew
254+ let wxPerLpNewX8 = (poolWxEmissionPerBlock / stakedTotalNew)
255+ let wxPerLpIntegralLastUpdHeightNew = height
256+ let wxPerLpIntegralUserLastUpdHeightNew = height
257+ let debug = makeString([toString(wxToClaimUserNew), toString(wxPerLpIntegralNew), toString(wxPerLpIntegralUserLast), toString(stakedByUser), toString(dh), toString(wxPerLpX8), toString(stakedTotal), toString(poolWxEmissionPerBlock), toString(wxEmissionPerBlock), toString(poolWeight), toString(height)], "::")
258+ $Tuple3(wxToClaimUserNew, [IntegerEntry(wxPerLpIntegralKEY, wxPerLpIntegralNew), IntegerEntry(wxPerLpIntegralLastUpdHeightKEY, wxPerLpIntegralLastUpdHeightNew), IntegerEntry(wxToClaimUserKEY, wxToClaimUserNew), IntegerEntry(wxPerLpIntegralUserLastUpdHeightKEY, wxPerLpIntegralUserLastUpdHeightNew), IntegerEntry(wxPerLpKEY, wxPerLpNewX8), IntegerEntry(wxPerLpIntegralUserLastKEY, wxPerLpIntegralUserLastNew)], debug)
259+ }
260+
261+
39262 @Callable(i)
40263 func constructor (factoryAddressStr) = if ((i.caller != this))
41264 then throw("not authorized")
44267
45268
46269 @Callable(i)
47-func stake () = {
48- let factory = readFactoryAddressOrFail()
49- if ((size(i.payments) != 1))
50- then throw("invalid payment - exact one payment must be attached")
270+func stake () = if ((size(i.payments) != 1))
271+ then throw("invalid payment - exact one payment must be attached")
272+ else {
273+ let pmt = i.payments[0]
274+ let lpAssetId = value(pmt.assetId)
275+ let lpAssetIdStr = toBase58String(lpAssetId)
276+ let amount = pmt.amount
277+ let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
278+ let callerStr = toString(i.caller)
279+ let userAddressStr = if ((callerStr == poolAddressStr))
280+ then toString(i.originCaller)
281+ else callerStr
282+ let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
283+ let stakedTotalKEY = keyStakedTotal(lpAssetIdStr)
284+ let stakedByUser = readStaked(stakedByUserKEY)
285+ let stakedTotal = readStaked(stakedTotalKEY)
286+ let $t01258812705 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount)
287+ let wxToClaimUserNew = $t01258812705._1
288+ let integralSTATE = $t01258812705._2
289+ let debug = $t01258812705._3
290+ ([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE)
291+ }
292+
293+
294+
295+@Callable(i)
296+func unstake (lpAssetIdStr,amount) = {
297+ let userAddressStr = toString(i.caller)
298+ let lpAssetId = fromBase58String(lpAssetIdStr)
299+ let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
300+ let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
301+ let stakedTotalKEY = keyStakedTotal(lpAssetIdStr)
302+ let stakedByUser = readStaked(stakedByUserKEY)
303+ let stakedTotal = readStaked(stakedTotalKEY)
304+ let $t01352213640 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount))
305+ let wxToClaimUserNew = $t01352213640._1
306+ let integralSTATE = $t01352213640._2
307+ let debug = $t01352213640._3
308+ if ((amount > stakedByUser))
309+ then throw("passed amount is less then available")
310+ else ([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE)
311+ }
312+
313+
314+
315+@Callable(i)
316+func claimWx (lpAssetIdStr) = {
317+ let userAddress = i.caller
318+ let userAddressStr = toString(i.caller)
319+ let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr))
320+ let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr)
321+ let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr)
322+ let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr)
323+ let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr)
324+ let claimedByUser = getIntOrZero(this, claimedByUserKEY)
325+ let claimedByUserMinReward = getIntOrZero(this, claimedByUserMinRewardKEY)
326+ let claimedByUserBoostReward = getIntOrZero(this, claimedByUserBoostRewardKEY)
327+ let claimedTotal = getIntOrZero(this, claimedTotalKEY)
328+ let $t01483214944 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0)
329+ let wxToClaimUserNew = $t01483214944._1
330+ let integralSTATE = $t01483214944._2
331+ let debug = $t01483214944._3
332+ let availableToClaim = (wxToClaimUserNew - claimedByUser)
333+ if ((0 >= availableToClaim))
334+ then throw("nothing to claim")
51335 else {
52- let pmt = i.payments[0]
53- let lpAssetId = value(pmt.assetId)
54- let lpAssetIdStr = toBase58String(lpAssetId)
55- let amount = pmt.amount
56- let lpDappStr = valueOrErrorMessage(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
57- let callerStr = toString(i.caller)
58- let userAddressStr = if ((callerStr == lpDappStr))
59- then toString(i.originCaller)
60- else callerStr
61- let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
62- let stakedTotalKEY = keyStakedTotal(lpAssetIdStr)
63- let stakedByUser = readStaked(stakedByUserKEY)
64- let stakedTotal = readStaked(stakedTotalKEY)
65-[IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)]
336+ let wxAmountBoostTotal = asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0])
337+ let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
338+ let minRewardPart = availableToClaim
339+ let boostRewardPart = min([(minRewardPart * 2), wxAmountBoostTotal])
340+ let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [minRewardPart], nil))[0])
341+ let emitBoost = asAnyList(invoke(emissionContract, "emit", [boostRewardPart], nil))
342+ if ((emitBoost == emitBoost))
343+ then [IntegerEntry(claimedByUserKEY, (claimedByUser + availableToClaim)), IntegerEntry(claimedByUserMinRewardKEY, (claimedByUserMinReward + minRewardPart)), IntegerEntry(claimedByUserBoostRewardKEY, (claimedByUserBoostReward + boostRewardPart)), IntegerEntry(claimedTotalKEY, (claimedTotal + availableToClaim)), ScriptTransfer(userAddress, minRewardPart, wxAssetId), ScriptTransfer(userAddress, boostRewardPart, wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, availableToClaim, i.transactionId)]
344+ else throw("Strict value is not equal to itself.")
66345 }
67346 }
68347
69348
70349
71350 @Callable(i)
72-func unstake (lpAssetIdStr,amount) = {
73- let factory = readFactoryAddressOrFail()
74- let lpAssetId = fromBase58String(lpAssetIdStr)
75- let lpDappStr = valueOrErrorMessage(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
76- let callerStr = toString(i.caller)
77- let userAddressStr = if ((callerStr == lpDappStr))
78- then toString(i.originCaller)
79- else callerStr
351+func claimWxREADONLY (lpAssetIdStr,userAddressStr) = {
80352 let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
81353 let stakedTotalKEY = keyStakedTotal(lpAssetIdStr)
354+ let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr)
82355 let stakedByUser = readStaked(stakedByUserKEY)
83356 let stakedTotal = readStaked(stakedTotalKEY)
84- if ((amount > stakedByUser))
85- then throw("passed amount is less then available")
86- else [IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)]
357+ let claimedByUser = getIntOrZero(this, claimedByUserKEY)
358+ let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr))
359+ let poolWeightMult = MULT8
360+ let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
361+ let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent())
362+ let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock())
363+ let passedBlocks = if ((emissionStartBlock > height))
364+ then 0
365+ else (height - emissionStartBlock)
366+ let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, poolWeightMult)
367+ let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal)
368+ let $t01729517407 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0)
369+ let wxToClaimUserNew = $t01729517407._1
370+ let integralSTATE = $t01729517407._2
371+ let debug = $t01729517407._3
372+ let availableToClaim = (wxToClaimUserNew - claimedByUser)
373+ let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil))
374+ let wxAmountBoostTotal = asInt(boostInvResult[0])
375+ let boostDebug = asString(boostInvResult[1])
376+ let minRewardPart = availableToClaim
377+ let boostRewardPart = min([(minRewardPart * 2), wxAmountBoostTotal])
378+ let totalReward = (minRewardPart + boostRewardPart)
379+ $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), ((((debug + "::") + toString(userWxReward)) + "::BOOSTDEBUG::") + boostDebug)], SEP))
87380 }
88-
89-
90-
91-@Callable(i)
92-func claimWx (lpAssetIdStr) = throw("temorary disabled")
93-
94-
95-
96-@Callable(i)
97-func claimWxREADONLY (lpAssetIdStr,userAddress) = $Tuple2(nil, makeString(["%s%s%d", lpAssetIdStr, userAddress, "0"], SEP))
98381
99382
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let SCALE8 = 8
5+
6+let MULT8 = 100000000
7+
8+let SCALE18 = 18
9+
10+let MULT18 = toBigInt(1000000000000000000)
11+
412 let SEP = "__"
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 asInt (val) = match val {
25+ case valInt: Int =>
26+ valInt
27+ case _ =>
28+ throw("fail to cast into Int")
29+}
30+
31+
32+func asString (val) = match val {
33+ case valStr: String =>
34+ valStr
35+ case _ =>
36+ throw("fail to cast into Int")
37+}
38+
39+
40+func asByteVector (val) = match val {
41+ case valBin: ByteVector =>
42+ valBin
43+ case _ =>
44+ throw("fail to cast into Int")
45+}
46+
547
648 func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined"))
749
850
951 func getStringByAddressOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined"))
1052
1153
54+func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0)
55+
56+
57+func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal)
58+
59+
60+func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined"))
61+
62+
63+func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult))
64+
65+
66+func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18))
67+
68+
1269 func keyFactoryAddress () = "%s%s__config__factoryAddress"
70+
71+
72+let IdxFactoryCfgStakingDapp = 1
73+
74+let IdxFactoryCfgBoostingDapp = 2
75+
76+let IdxFactoryCfgIdoDapp = 3
77+
78+let IdxFactoryCfgTeamDapp = 4
79+
80+let IdxFactoryCfgEmissionDapp = 5
81+
82+let IdxFactoryCfgRestDapp = 6
83+
84+let IdxFactoryCfgSlippageDapp = 7
85+
86+func keyFactoryCfg () = "%s__factoryConfig"
1387
1488
1589 func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
1690
1791
92+func keyFactoryLpList () = "%s__lpTokensList"
93+
94+
95+func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
96+
97+
98+func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
99+
100+
18101 func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(keyFactoryAddress()))
102+
103+
104+func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP)
105+
106+
107+func readFactoryCfgOrFail (factory) = split(getStringByAddressOrFail(factory, keyFactoryCfg()), SEP)
108+
109+
110+func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp])
111+
112+
113+func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp])
114+
115+
116+func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp])
117+
118+
119+func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
120+
121+
122+func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current"
123+
124+
125+func keyEmissionStartBlock () = "%s%s__emission__startBlock"
126+
127+
128+func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
129+
130+
131+func keyEmissionEndBlock () = "%s%s__emission__endBlock"
19132
20133
21134 func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s__staked", userAddressStr, lpAssetIdStr], SEP)
22135
23136
24137 func keyStakedTotal (lpAssetIdStr) = ("%s%s%s__staked__total__" + lpAssetIdStr)
25138
26139
140+func keyClaimedByUser (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimed", userAddressStr, lpAssetIdStr], SEP)
141+
142+
143+func keyClaimedByUserMinReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedMinReward", userAddressStr, lpAssetIdStr], SEP)
144+
145+
146+func keyClaimedByUserBoostReward (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s__claimedBoostReward", userAddressStr, lpAssetIdStr], SEP)
147+
148+
149+func keyClaimedTotal (lpAssetIdStr) = makeString(["%s%s%s__claimed", "total", lpAssetIdStr], SEP)
150+
151+
27152 func readStaked (key) = valueOrElse(getInteger(this, key), 0)
153+
154+
155+func keyLastTotalLpBalance (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "bal"], SEP)
156+
157+
158+func keyLastUserLpBalance (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "bal"], SEP)
159+
160+
161+func keyTotalLpBalanceIntegral (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "balINT"], SEP)
162+
163+
164+func keyUserLpBalanceIntegral (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "balINT"], SEP)
165+
166+
167+func keyTotalLpBalanceIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s", lpAssetId, "total", "lastUpd"], SEP)
168+
169+
170+func keyUserLpBalanceIntegralLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s", lpAssetId, userAddress, "lastUpd"], SEP)
171+
172+
173+func keyWxPerLpIntegral (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpInt"], SEP)
174+
175+
176+func keyWxPerLpIntegralLastUpdHeight (lpAssetId) = makeString(["%s%s%s%s", lpAssetId, "common", "lpIntH"], SEP)
177+
178+
179+func keyWxToClaimUser (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpInt"], SEP)
180+
181+
182+func keyWxPerLpIntegralUserLastUpdHeight (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "lpIntH"], SEP)
183+
184+
185+func keyWxPerLp (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLp"], SEP)
186+
187+
188+func keyWxPerLpX18 (lpAssetId) = makeString(["%s", lpAssetId, "wxPerLpX18"], SEP)
189+
190+
191+func keyWxPerLpIntegralUserLast (lpAssetId,userAddress) = makeString(["%s%s%s%s", lpAssetId, userAddress, "uIntL"], SEP)
28192
29193
30194 func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP)
31195
32196
33197 func formatHistoryRecord (userAddress,lpAssetId,type,amount) = makeString(["%s%s%s%d%d%d", userAddress, lpAssetId, type, toString(height), toString(lastBlock.timestamp), toString(amount)], SEP)
34198
35199
36200 func OperationHistoryEntry (type,userAddress,lpAssetId,amount,txId) = StringEntry(keyOperationHistoryRecord(type, userAddress, toBase58String(txId)), formatHistoryRecord(userAddress, lpAssetId, type, amount))
37201
38202
203+let factoryContract = readFactoryAddressOrFail()
204+
205+let factoryCfg = readFactoryCfgOrFail(factoryContract)
206+
207+let emissionContract = getEmissionAddressOrFail(factoryCfg)
208+
209+let boostingContract = getBoostingAddressOrFail(factoryCfg)
210+
211+func calcWxPerLpIntegralUserLast (stakedByUser,wxPerLpIntegralUserLastUpdHeightOrZero,wxPerLpIntegralNew,wxPerLpIntegralUserLastKEY) = if (if ((wxPerLpIntegralUserLastUpdHeightOrZero == 0))
212+ then (stakedByUser > 0)
213+ else false)
214+ then 0
215+ else if ((stakedByUser == 0))
216+ then wxPerLpIntegralNew
217+ else if (if ((wxPerLpIntegralUserLastUpdHeightOrZero > 0))
218+ then (stakedByUser > 0)
219+ else false)
220+ then getIntOrFail(this, wxPerLpIntegralUserLastKEY)
221+ else throw("calcWxPerLpIntegralUserLast: unexpected state")
222+
223+
224+func refreshINTEGRALS (lpAssetIdStr,userAddressStr,poolAddressStr,lpDeltaAmount) = {
225+ let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
226+ let stakedTotalKEY = keyStakedTotal(lpAssetIdStr)
227+ let stakedByUser = readStaked(stakedByUserKEY)
228+ let stakedTotal = readStaked(stakedTotalKEY)
229+ let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
230+ let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock())
231+ let MULT3 = 1000
232+ let wxEmissionPerBlock = (getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) * MULT3)
233+ let poolWxEmissionPerBlock = fraction(wxEmissionPerBlock, poolWeight, (POOLWEIGHTMULT * 3))
234+ let wxPerLpIntegralKEY = keyWxPerLpIntegral(lpAssetIdStr)
235+ let wxPerLpIntegralLastUpdHeightKEY = keyWxPerLpIntegralLastUpdHeight(lpAssetIdStr)
236+ let wxToClaimUserKEY = keyWxToClaimUser(lpAssetIdStr, userAddressStr)
237+ let wxPerLpIntegralUserLastUpdHeightKEY = keyWxPerLpIntegralUserLastUpdHeight(lpAssetIdStr, userAddressStr)
238+ let wxPerLpKEY = keyWxPerLp(lpAssetIdStr)
239+ let wxPerLpIntegralUserLastKEY = keyWxPerLpIntegralUserLast(lpAssetIdStr, userAddressStr)
240+ let wxPerLpIntegralLastUpdHeight = getIntOrDefault(this, wxPerLpIntegralLastUpdHeightKEY, emissionStartBlock)
241+ let wxPerLpIntegral = getIntOrZero(this, wxPerLpIntegralKEY)
242+ let wxToClaimUser = getIntOrZero(this, wxToClaimUserKEY)
243+ let wxPerLpIntegralUserLastUpdHeightOrZero = getIntOrZero(this, wxPerLpIntegralUserLastUpdHeightKEY)
244+ let wxPerLpOrZeroX8 = getIntOrZero(this, wxPerLpKEY)
245+ let dh = max([(height - wxPerLpIntegralLastUpdHeight), 0])
246+ let wxPerLpX8 = if ((wxPerLpOrZeroX8 != 0))
247+ then wxPerLpOrZeroX8
248+ else fraction(poolWxEmissionPerBlock, MULT8, stakedTotal)
249+ let stakedTotalNew = (stakedTotal + lpDeltaAmount)
250+ let wxPerLpIntegralNew = (wxPerLpIntegral + (wxPerLpX8 * dh))
251+ let wxPerLpIntegralUserLast = calcWxPerLpIntegralUserLast(stakedByUser, wxPerLpIntegralUserLastUpdHeightOrZero, wxPerLpIntegralNew, wxPerLpIntegralUserLastKEY)
252+ let wxToClaimUserNew = (wxToClaimUser + fraction((wxPerLpIntegralNew - wxPerLpIntegralUserLast), stakedByUser, (MULT8 * MULT3)))
253+ let wxPerLpIntegralUserLastNew = wxPerLpIntegralNew
254+ let wxPerLpNewX8 = (poolWxEmissionPerBlock / stakedTotalNew)
255+ let wxPerLpIntegralLastUpdHeightNew = height
256+ let wxPerLpIntegralUserLastUpdHeightNew = height
257+ let debug = makeString([toString(wxToClaimUserNew), toString(wxPerLpIntegralNew), toString(wxPerLpIntegralUserLast), toString(stakedByUser), toString(dh), toString(wxPerLpX8), toString(stakedTotal), toString(poolWxEmissionPerBlock), toString(wxEmissionPerBlock), toString(poolWeight), toString(height)], "::")
258+ $Tuple3(wxToClaimUserNew, [IntegerEntry(wxPerLpIntegralKEY, wxPerLpIntegralNew), IntegerEntry(wxPerLpIntegralLastUpdHeightKEY, wxPerLpIntegralLastUpdHeightNew), IntegerEntry(wxToClaimUserKEY, wxToClaimUserNew), IntegerEntry(wxPerLpIntegralUserLastUpdHeightKEY, wxPerLpIntegralUserLastUpdHeightNew), IntegerEntry(wxPerLpKEY, wxPerLpNewX8), IntegerEntry(wxPerLpIntegralUserLastKEY, wxPerLpIntegralUserLastNew)], debug)
259+ }
260+
261+
39262 @Callable(i)
40263 func constructor (factoryAddressStr) = if ((i.caller != this))
41264 then throw("not authorized")
42265 else [StringEntry(keyFactoryAddress(), factoryAddressStr)]
43266
44267
45268
46269 @Callable(i)
47-func stake () = {
48- let factory = readFactoryAddressOrFail()
49- if ((size(i.payments) != 1))
50- then throw("invalid payment - exact one payment must be attached")
270+func stake () = if ((size(i.payments) != 1))
271+ then throw("invalid payment - exact one payment must be attached")
272+ else {
273+ let pmt = i.payments[0]
274+ let lpAssetId = value(pmt.assetId)
275+ let lpAssetIdStr = toBase58String(lpAssetId)
276+ let amount = pmt.amount
277+ let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
278+ let callerStr = toString(i.caller)
279+ let userAddressStr = if ((callerStr == poolAddressStr))
280+ then toString(i.originCaller)
281+ else callerStr
282+ let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
283+ let stakedTotalKEY = keyStakedTotal(lpAssetIdStr)
284+ let stakedByUser = readStaked(stakedByUserKEY)
285+ let stakedTotal = readStaked(stakedTotalKEY)
286+ let $t01258812705 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, amount)
287+ let wxToClaimUserNew = $t01258812705._1
288+ let integralSTATE = $t01258812705._2
289+ let debug = $t01258812705._3
290+ ([IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE)
291+ }
292+
293+
294+
295+@Callable(i)
296+func unstake (lpAssetIdStr,amount) = {
297+ let userAddressStr = toString(i.caller)
298+ let lpAssetId = fromBase58String(lpAssetIdStr)
299+ let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
300+ let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
301+ let stakedTotalKEY = keyStakedTotal(lpAssetIdStr)
302+ let stakedByUser = readStaked(stakedByUserKEY)
303+ let stakedTotal = readStaked(stakedTotalKEY)
304+ let $t01352213640 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, -(amount))
305+ let wxToClaimUserNew = $t01352213640._1
306+ let integralSTATE = $t01352213640._2
307+ let debug = $t01352213640._3
308+ if ((amount > stakedByUser))
309+ then throw("passed amount is less then available")
310+ else ([IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)] ++ integralSTATE)
311+ }
312+
313+
314+
315+@Callable(i)
316+func claimWx (lpAssetIdStr) = {
317+ let userAddress = i.caller
318+ let userAddressStr = toString(i.caller)
319+ let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr))
320+ let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr)
321+ let claimedTotalKEY = keyClaimedTotal(lpAssetIdStr)
322+ let claimedByUserMinRewardKEY = keyClaimedByUserMinReward(lpAssetIdStr, userAddressStr)
323+ let claimedByUserBoostRewardKEY = keyClaimedByUserBoostReward(lpAssetIdStr, userAddressStr)
324+ let claimedByUser = getIntOrZero(this, claimedByUserKEY)
325+ let claimedByUserMinReward = getIntOrZero(this, claimedByUserMinRewardKEY)
326+ let claimedByUserBoostReward = getIntOrZero(this, claimedByUserBoostRewardKEY)
327+ let claimedTotal = getIntOrZero(this, claimedTotalKEY)
328+ let $t01483214944 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0)
329+ let wxToClaimUserNew = $t01483214944._1
330+ let integralSTATE = $t01483214944._2
331+ let debug = $t01483214944._3
332+ let availableToClaim = (wxToClaimUserNew - claimedByUser)
333+ if ((0 >= availableToClaim))
334+ then throw("nothing to claim")
51335 else {
52- let pmt = i.payments[0]
53- let lpAssetId = value(pmt.assetId)
54- let lpAssetIdStr = toBase58String(lpAssetId)
55- let amount = pmt.amount
56- let lpDappStr = valueOrErrorMessage(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
57- let callerStr = toString(i.caller)
58- let userAddressStr = if ((callerStr == lpDappStr))
59- then toString(i.originCaller)
60- else callerStr
61- let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
62- let stakedTotalKEY = keyStakedTotal(lpAssetIdStr)
63- let stakedByUser = readStaked(stakedByUserKEY)
64- let stakedTotal = readStaked(stakedTotalKEY)
65-[IntegerEntry(stakedByUserKEY, (stakedByUser + amount)), IntegerEntry(stakedTotalKEY, (stakedTotal + amount)), OperationHistoryEntry("stake", userAddressStr, lpAssetIdStr, amount, i.transactionId)]
336+ let wxAmountBoostTotal = asInt(asAnyList(invoke(boostingContract, "claimWxBoost", [lpAssetIdStr, userAddressStr], nil))[0])
337+ let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
338+ let minRewardPart = availableToClaim
339+ let boostRewardPart = min([(minRewardPart * 2), wxAmountBoostTotal])
340+ let wxAssetId = asByteVector(asAnyList(invoke(emissionContract, "emit", [minRewardPart], nil))[0])
341+ let emitBoost = asAnyList(invoke(emissionContract, "emit", [boostRewardPart], nil))
342+ if ((emitBoost == emitBoost))
343+ then [IntegerEntry(claimedByUserKEY, (claimedByUser + availableToClaim)), IntegerEntry(claimedByUserMinRewardKEY, (claimedByUserMinReward + minRewardPart)), IntegerEntry(claimedByUserBoostRewardKEY, (claimedByUserBoostReward + boostRewardPart)), IntegerEntry(claimedTotalKEY, (claimedTotal + availableToClaim)), ScriptTransfer(userAddress, minRewardPart, wxAssetId), ScriptTransfer(userAddress, boostRewardPart, wxAssetId), OperationHistoryEntry("claim", userAddressStr, lpAssetIdStr, availableToClaim, i.transactionId)]
344+ else throw("Strict value is not equal to itself.")
66345 }
67346 }
68347
69348
70349
71350 @Callable(i)
72-func unstake (lpAssetIdStr,amount) = {
73- let factory = readFactoryAddressOrFail()
74- let lpAssetId = fromBase58String(lpAssetIdStr)
75- let lpDappStr = valueOrErrorMessage(getString(factory, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr))
76- let callerStr = toString(i.caller)
77- let userAddressStr = if ((callerStr == lpDappStr))
78- then toString(i.originCaller)
79- else callerStr
351+func claimWxREADONLY (lpAssetIdStr,userAddressStr) = {
80352 let stakedByUserKEY = keyStakedByUser(userAddressStr, lpAssetIdStr)
81353 let stakedTotalKEY = keyStakedTotal(lpAssetIdStr)
354+ let claimedByUserKEY = keyClaimedByUser(lpAssetIdStr, userAddressStr)
82355 let stakedByUser = readStaked(stakedByUserKEY)
83356 let stakedTotal = readStaked(stakedTotalKEY)
84- if ((amount > stakedByUser))
85- then throw("passed amount is less then available")
86- else [IntegerEntry(stakedByUserKEY, (stakedByUser - amount)), IntegerEntry(stakedTotalKEY, (stakedTotal - amount)), ScriptTransfer(i.caller, amount, lpAssetId), OperationHistoryEntry("unstake", userAddressStr, lpAssetIdStr, amount, i.transactionId)]
357+ let claimedByUser = getIntOrZero(this, claimedByUserKEY)
358+ let poolAddressStr = getStringByAddressOrFail(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr))
359+ let poolWeightMult = MULT8
360+ let poolWeight = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr))
361+ let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent())
362+ let emissionStartBlock = getIntOrFail(emissionContract, keyEmissionStartBlock())
363+ let passedBlocks = if ((emissionStartBlock > height))
364+ then 0
365+ else (height - emissionStartBlock)
366+ let poolWxEmission = fraction((wxEmissionPerBlock * passedBlocks), poolWeight, poolWeightMult)
367+ let userWxReward = fraction(poolWxEmission, stakedByUser, stakedTotal)
368+ let $t01729517407 = refreshINTEGRALS(lpAssetIdStr, userAddressStr, poolAddressStr, 0)
369+ let wxToClaimUserNew = $t01729517407._1
370+ let integralSTATE = $t01729517407._2
371+ let debug = $t01729517407._3
372+ let availableToClaim = (wxToClaimUserNew - claimedByUser)
373+ let boostInvResult = asAnyList(invoke(boostingContract, "claimWxBoostREADONLY", [lpAssetIdStr, userAddressStr], nil))
374+ let wxAmountBoostTotal = asInt(boostInvResult[0])
375+ let boostDebug = asString(boostInvResult[1])
376+ let minRewardPart = availableToClaim
377+ let boostRewardPart = min([(minRewardPart * 2), wxAmountBoostTotal])
378+ let totalReward = (minRewardPart + boostRewardPart)
379+ $Tuple2(nil, makeString(["%s%s%d%d%d%d%s", lpAssetIdStr, userAddressStr, toString(totalReward), toString(claimedByUser), toString(minRewardPart), toString(boostRewardPart), ((((debug + "::") + toString(userWxReward)) + "::BOOSTDEBUG::") + boostDebug)], SEP))
87380 }
88-
89-
90-
91-@Callable(i)
92-func claimWx (lpAssetIdStr) = throw("temorary disabled")
93-
94-
95-
96-@Callable(i)
97-func claimWxREADONLY (lpAssetIdStr,userAddress) = $Tuple2(nil, makeString(["%s%s%d", lpAssetIdStr, userAddress, "0"], SEP))
98381
99382

github/deemru/w8io/169f3d6 
47.15 ms