tx · 7L2X6cEFBPWHmdncQoHzyT1DLNWebqc9YoU9TCWiuwVu

3N6HSS7Toat1RhyEsyqVGgVSRzH19W1FTbP:  -0.01900000 Waves

2023.06.21 14:00 [2632312] smart account 3N6HSS7Toat1RhyEsyqVGgVSRzH19W1FTbP > SELF 0.00000000 Waves

{ "type": 13, "id": "7L2X6cEFBPWHmdncQoHzyT1DLNWebqc9YoU9TCWiuwVu", "fee": 1900000, "feeAssetId": null, "timestamp": 1687345329386, "version": 2, "chainId": 84, "sender": "3N6HSS7Toat1RhyEsyqVGgVSRzH19W1FTbP", "senderPublicKey": "AoKo4segKHU4DeJnxXQYJj2u7J6XJeux6r8KLW52cd2Q", "proofs": [ "32BCAHjMGVjebAACYshtHMPUetXwtJj2M1D89GcPk64E7CuavBTnitkxwrMKaDC2vgxDTgSrhrKgX59NGntJV9ZR" ], "script": "base64:BwIrCAISAwoBAhIHCgUCAQEBARIDCgECEgMKAQISBAoCAgISBAoCAgISAwoBAicAA1NFUAICX18ADUNPTlRSQUNUX05BTUUCD2NhbGN1bGF0b3IucmlkZQAGU0NBTEU4AIDC1y8AB1BFTkRJTkcCB1BFTkRJTkcACEZJTklTSEVEAghGSU5JU0hFRAAFV0FWRVMCBVdBVkVTAQd3cmFwRXJyAQFzCQCsAgIJAKwCAgUNQ09OVFJBQ1RfTkFNRQICOiAFAXMBCHRocm93RXJyAQFzCQACAQkBB3dyYXBFcnIBBQFzAQ9hc3NldElkVG9TdHJpbmcBB2Fzc2V0SWQEByRtYXRjaDAFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQBYgUHJG1hdGNoMAkA2AQBBQFiAwkAAQIFByRtYXRjaDACBFVuaXQFBVdBVkVTCQACAQILTWF0Y2ggZXJyb3IBA2FicwEBbgMJAGYCAAAFAW4JAQEtAQUBbgUBbgERa2V5RmFjdG9yeUFkZHJlc3MACQC5CQIJAMwIAgICJXMJAMwIAgIHZmFjdG9yeQUDbmlsBQNTRVAB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EDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5uwdghQ==", "height": 2632312, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2gXw4zBaDWfMqYvJ3C8MSDrbNddPqjuU1aPjMc33sAAY Next: 2BKD6hYCQoca8zJa9hG3XpSTYCvUDbYtsubAg9ger5b3 Diff:
OldNewDifferences
2929 }
3030
3131
32+func abs (n) = if ((0 > n))
33+ then -(n)
34+ else n
35+
36+
3237 func keyFactoryAddress () = makeString(["%s", "factory"], SEP)
3338
3439
3540 func keyLpAssetId () = makeString(["%s", "lpAssetId"], SEP)
41+
42+
43+func keyXtnAssetId () = makeString(["%s", "xtnAssetId"], SEP)
3644
3745
3846 func keyTreasuryAddress () = makeString(["%s", "treasury"], SEP)
130138
131139 let lpAssetIdOrFail = valueOrErrorMessage(lpAssetIdOption, wrapErr("invalid lpAssetId"))
132140
141+let xtnAssetIdOption = match factoryAddressOption {
142+ case a: Address =>
143+ match getString(a, keyXtnAssetId()) {
144+ case s: String =>
145+ fromBase58String(s)
146+ case _: Unit =>
147+ unit
148+ case _ =>
149+ throw("Match error")
150+ }
151+ case _: Unit =>
152+ unit
153+ case _ =>
154+ throw("Match error")
155+}
156+
157+let xtnAssetIdOrFail = valueOrErrorMessage(xtnAssetIdOption, wrapErr("invalid xtnAssetId"))
158+
133159 let treasuryAddressOption = match factoryAddressOption {
134160 case a: Address =>
135161 match getString(a, keyTreasuryAddress()) {
158184
159185 func rewardForOption (rewards,target) = {
160186 let s = size(rewards)
161- let $t036623687 = rewards[0]
162- let a0 = $t036623687._1
163- let r0 = $t036623687._2
164- let $t036903715 = rewards[1]
165- let a1 = $t036903715._1
166- let r1 = $t036903715._2
167- let $t037183743 = rewards[2]
168- let a2 = $t037183743._1
169- let r2 = $t037183743._2
187+ let $t040734098 = rewards[0]
188+ let a0 = $t040734098._1
189+ let r0 = $t040734098._2
190+ let $t041014126 = rewards[1]
191+ let a1 = $t041014126._1
192+ let r1 = $t041014126._2
193+ let $t041294154 = rewards[2]
194+ let a2 = $t041294154._1
195+ let r2 = $t041294154._2
170196 if (if ((s > 0))
171197 then (a0 == target)
172198 else false)
192218 let available = valueOrElse(getInteger(factoryAddressOrFail, keyAvailable(userAddress)), 0)
193219 let claimed = valueOrElse(getInteger(factoryAddressOrFail, keyClaimed(userAddress)), 0)
194220 let factoryActions = if ((available > 0))
195- then [invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, available, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(userAddress), 0], nil), invoke(factoryAddressOrFail, "stringEntry", [keyClaimed(userAddress), (claimed + available)], nil)]
221+ then [invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, available, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(userAddress), 0], nil), invoke(factoryAddressOrFail, "integerEntry", [keyClaimed(userAddress), (claimed + available)], nil)]
196222 else throwErr("nothing to claim")
197223 $Tuple2(nil, factoryActions)
198224 }
202228
203229
204230 @Callable(i)
205-func finalize (newTreasuryVolumeInWaves,xtnPrice,pwrManagersBonus,treasuryVolumeDiffAllocationCoef) = {
206- let checks = [if ((i.originCaller == factoryAddressOrFail))
207- then true
208- else throwErr("permission denied"), if ((newTreasuryVolumeInWaves >= 0))
209- then true
210- else throwErr("invalid new treasury volume"), if ((xtnPrice >= 0))
211- then true
212- else throwErr("invalid XTN price"), if (if ((pwrManagersBonus >= 0))
213- then (SCALE8 >= pwrManagersBonus)
214- else false)
215- then true
216- else throwErr("invalid PWR managers bonus"), if (if ((treasuryVolumeDiffAllocationCoef >= -(SCALE8)))
217- then (SCALE8 >= treasuryVolumeDiffAllocationCoef)
218- else false)
219- then true
220- else throwErr("invalid treasury volume diff allocation coefficient")]
221- if ((checks == checks))
231+func finalize (userAddressBytes,newTreasuryVolumeInWaves,xtnPrice,pwrManagersBonus,treasuryVolumeDiffAllocationCoef) = {
232+ let checkCaller = onlyFactory(i)
233+ if ((checkCaller == checkCaller))
222234 then {
223235 let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period"))
224- let newPeriod = (currentPeriodOrFail + 1)
225- let newPrice = SCALE8
226- let lpAssetAmountToBurn = 0
227- let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyCurrentPeriod(), newPeriod], nil), invoke(factoryAddressOrFail, "integerEntry", [keyPriceForPeriod(newPeriod), newPrice], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmountToBurn], nil)]
228- $Tuple2(nil, factoryActions)
236+ let periodLength = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPeriodLength()), wrapErr("invalid period length"))
237+ let currentStartHeight = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyStartHeight(currentPeriodOrFail)), wrapErr("invalid start height"))
238+ let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price"))
239+ let nextBlockToProcess = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyNextBlockToProcess()), wrapErr("invalid next block to process"))
240+ let periodEndHeight = ((currentStartHeight + periodLength) - 1)
241+ let checks = [if ((nextBlockToProcess > periodEndHeight))
242+ then true
243+ else throwErr("unprocessed blocks"), if ((newTreasuryVolumeInWaves >= 0))
244+ then true
245+ else throwErr("invalid new treasury volume"), if ((xtnPrice >= 0))
246+ then true
247+ else throwErr("invalid XTN price"), if (if ((pwrManagersBonus >= 0))
248+ then (SCALE8 >= pwrManagersBonus)
249+ else false)
250+ then true
251+ else throwErr("invalid PWR managers bonus"), if (if ((treasuryVolumeDiffAllocationCoef >= -(SCALE8)))
252+ then (SCALE8 >= treasuryVolumeDiffAllocationCoef)
253+ else false)
254+ then true
255+ else throwErr("invalid treasury volume diff allocation coefficient")]
256+ if ((checks == checks))
257+ then {
258+ let investedXtnAmount = valueOrElse(getInteger(factoryAddressOrFail, keyInvested(xtnAssetIdOrFail)), 0)
259+ let investedWavesAmount = valueOrElse(getInteger(factoryAddressOrFail, keyInvested(unit)), 0)
260+ let investedXtnAmountInWaves = fraction(investedXtnAmount, xtnPrice, SCALE8)
261+ let currentTreasuryVolumeInWaves = (investedXtnAmountInWaves + investedWavesAmount)
262+ let profitRaw = (newTreasuryVolumeInWaves - currentTreasuryVolumeInWaves)
263+ let pwrManagersBonusAmount = if ((profitRaw > 0))
264+ then fraction(profitRaw, pwrManagersBonus, SCALE8)
265+ else 0
266+ let profit = (profitRaw - pwrManagersBonusAmount)
267+ let donationPart = if ((currentTreasuryVolumeInWaves > 0))
268+ then fraction(investedXtnAmountInWaves, SCALE8, currentTreasuryVolumeInWaves)
269+ else 0
270+ let donationProfitPartRaw = fraction(profit, donationPart, SCALE8)
271+ let investmentProfitPartRaw = (profit - donationProfitPartRaw)
272+ let treasuryVolumeDiffAllocationCoefAbs = abs(treasuryVolumeDiffAllocationCoef)
273+ let amountToDonation = fraction(investmentProfitPartRaw, if ((0 > treasuryVolumeDiffAllocationCoef))
274+ then treasuryVolumeDiffAllocationCoefAbs
275+ else 0, SCALE8)
276+ let amountToInvestment = fraction(donationProfitPartRaw, if ((treasuryVolumeDiffAllocationCoef > 0))
277+ then treasuryVolumeDiffAllocationCoefAbs
278+ else 0, SCALE8)
279+ let donationProfitPart = ((donationProfitPartRaw - amountToInvestment) + amountToDonation)
280+ let investmentProfitPart = ((investmentProfitPartRaw - amountToDonation) + amountToInvestment)
281+ let investedWavesAmountNew = (investedWavesAmount + investmentProfitPart)
282+ let investedXtnAmountNew = fraction((investedXtnAmountInWaves + donationProfitPart), SCALE8, xtnPrice)
283+ let newPeriod = (currentPeriodOrFail + 1)
284+ let lpAssetQuantity = valueOrErrorMessage(assetInfo(lpAssetIdOrFail), wrapErr("invalid lpAsset info")).quantity
285+ let newPrice = fraction(investedWavesAmountNew, SCALE8, lpAssetQuantity)
286+ let lpAssetAmountToBurn = valueOrElse(getInteger(factoryAddressOrFail, keyWithdrawal()), 0)
287+ let paymentAmountMin = fraction(lpAssetAmountToBurn, newPrice, SCALE8)
288+ let checkPaymentAmount = if (if (if ((size(i.payments) == 1))
289+ then (i.payments[0].assetId == unit)
290+ else false)
291+ then (i.payments[0].amount >= paymentAmountMin)
292+ else false)
293+ then true
294+ else throwErr(("invalid payments, payment amount min: " + toString(paymentAmountMin)))
295+ if ((checkPaymentAmount == checkPaymentAmount))
296+ then {
297+ let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyCurrentPeriod(), newPeriod], nil), invoke(factoryAddressOrFail, "integerEntry", [keyPriceForPeriod(newPeriod), newPrice], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmountToBurn], nil), invoke(factoryAddressOrFail, "integerEntry", [keyWithdrawal(), 0], nil)]
298+ $Tuple2(nil, factoryActions)
299+ }
300+ else throw("Strict value is not equal to itself.")
301+ }
302+ else throw("Strict value is not equal to itself.")
229303 }
230304 else throw("Strict value is not equal to itself.")
231305 }
294368 then {
295369 let userAddress = Address(userAddressBytes)
296370 let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request"))
297- let $t093229435 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption)
298- let status = $t093229435._1
299- let lpAssetAmount = $t093229435._2
300- let targetPeriod = $t093229435._3
301- let claimTxId = $t093229435._4
302- if ((status == PENDING))
371+ let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period"))
372+ let $t01271312826 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption)
373+ let status = $t01271312826._1
374+ let lpAssetAmount = $t01271312826._2
375+ let targetPeriod = $t01271312826._3
376+ let claimTxId = $t01271312826._4
377+ let checks = [if ((status == PENDING))
378+ then true
379+ else throwErr("invalid withdrawal request status"), if ((targetPeriod > currentPeriodOrFail))
380+ then true
381+ else throwErr("invalid withdrawal request period")]
382+ if ((checks == checks))
303383 then {
304384 let withdrawal = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyWithdrawal()), wrapErr("invalid total withdrawal amount"))
305385 let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyWithdrawal(), if ((withdrawal >= lpAssetAmount))
309389 then $Tuple2(nil, factoryActions)
310390 else throw("Strict value is not equal to itself.")
311391 }
312- else throwErr("invalid withdrawal request status")
392+ else throw("Strict value is not equal to itself.")
313393 }
314394 else throw("Strict value is not equal to itself.")
315395 }
324404 let userAddress = Address(userAddressBytes)
325405 let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period"))
326406 let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request"))
327- let $t01071510828 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption)
328- let status = $t01071510828._1
329- let lpAssetAmount = $t01071510828._2
330- let targetPeriod = $t01071510828._3
331- let claimTxId = $t01071510828._4
407+ let $t01415814271 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption)
408+ let status = $t01415814271._1
409+ let lpAssetAmount = $t01415814271._2
410+ let targetPeriod = $t01415814271._3
411+ let claimTxId = $t01415814271._4
332412 if ((status == FINISHED))
333413 then throwErr("invalid withdrawal request status")
334414 else if ((targetPeriod > currentPeriodOrFail))
335415 then throwErr("invalid withdrawal request period")
336416 else {
337- let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price"))
338- let amount = if ((currentPriceOrFail > 0))
339- then fraction(lpAssetAmount, currentPriceOrFail, SCALE8)
417+ let priceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(targetPeriod)), wrapErr("invalid price"))
418+ let amount = if ((priceOrFail > 0))
419+ then fraction(lpAssetAmount, priceOrFail, SCALE8)
340420 else 0
341421 let factoryActions = [invoke(factoryAddressOrFail, "stringEntry", [keyWithdrawalRequest(userAddress, txId), valueWithdrawalRequest(FINISHED, lpAssetAmount, targetPeriod, i.transactionId)], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmount], nil), invoke(factoryAddressOrFail, "transferWaves", [userAddressBytes, amount], nil)]
342422 $Tuple2(nil, factoryActions)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 7 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let CONTRACT_NAME = "calculator.ride"
77
88 let SCALE8 = 100000000
99
1010 let PENDING = "PENDING"
1111
1212 let FINISHED = "FINISHED"
1313
1414 let WAVES = "WAVES"
1515
1616 func wrapErr (s) = ((CONTRACT_NAME + ": ") + s)
1717
1818
1919 func throwErr (s) = throw(wrapErr(s))
2020
2121
2222 func assetIdToString (assetId) = match assetId {
2323 case b: ByteVector =>
2424 toBase58String(b)
2525 case _: Unit =>
2626 WAVES
2727 case _ =>
2828 throw("Match error")
2929 }
3030
3131
32+func abs (n) = if ((0 > n))
33+ then -(n)
34+ else n
35+
36+
3237 func keyFactoryAddress () = makeString(["%s", "factory"], SEP)
3338
3439
3540 func keyLpAssetId () = makeString(["%s", "lpAssetId"], SEP)
41+
42+
43+func keyXtnAssetId () = makeString(["%s", "xtnAssetId"], SEP)
3644
3745
3846 func keyTreasuryAddress () = makeString(["%s", "treasury"], SEP)
3947
4048
4149 func keyInvested (assetId) = makeString(["%s%s", "invested", assetIdToString(assetId)], SEP)
4250
4351
4452 func keyAvailable (userAddress) = makeString(["%s%s", "available", toString(userAddress)], SEP)
4553
4654
4755 func keyClaimed (userAddress) = makeString(["%s%s", "claimed", toString(userAddress)], SEP)
4856
4957
5058 func keyCurrentPeriod () = makeString(["%s", "currentPeriod"], SEP)
5159
5260
5361 func keyPriceForPeriod (period) = makeString(["%s%d", "price", toString(period)], SEP)
5462
5563
5664 func keyStartHeight (period) = makeString(["%s%d", "startHeight", toString(period)], SEP)
5765
5866
5967 func keyPeriodLength () = "%s__periodLength"
6068
6169
6270 func keyBlockProcessingReward () = "%s__blockProcessingReward"
6371
6472
6573 func keyNextBlockToProcess () = "%s__nextBlockToProcess"
6674
6775
6876 func keyBlockProcessed (height) = makeString(["%s%d", "blockProcessed", toString(height)], SEP)
6977
7078
7179 func keyWithdrawal () = "%s__withdrawal"
7280
7381
7482 func keyWithdrawalRequest (userAddress,txId) = makeString(["%s%s%s", "withdrawal", toString(userAddress), toBase58String(txId)], SEP)
7583
7684
7785 func valueWithdrawalRequest (status,lpAssetAmount,targetPeriod,claimTxId) = {
7886 let claimTxIdStr = match claimTxId {
7987 case b: ByteVector =>
8088 toBase58String(b)
8189 case _: Unit =>
8290 "SOON"
8391 case _ =>
8492 throw("Match error")
8593 }
8694 makeString(["%s%d%d%s", status, toString(lpAssetAmount), toString(targetPeriod), claimTxIdStr], SEP)
8795 }
8896
8997
9098 func parseWithdrawalRequestValueOrFail (s) = {
9199 let parts = split(s, SEP)
92100 if ((size(parts) == 5))
93101 then {
94102 let status = parts[1]
95103 let lpAssetAmount = valueOrErrorMessage(parseInt(parts[2]), wrapErr("invalid lpAssetAmount"))
96104 let targetPeriod = valueOrErrorMessage(parseInt(parts[3]), wrapErr("invalid targetPeriod"))
97105 let claimTxId = parts[4]
98106 $Tuple4(status, lpAssetAmount, targetPeriod, claimTxId)
99107 }
100108 else throwErr("invalid withdrawal request value")
101109 }
102110
103111
104112 let factoryAddressOption = match getString(this, keyFactoryAddress()) {
105113 case s: String =>
106114 addressFromString(s)
107115 case _: Unit =>
108116 unit
109117 case _ =>
110118 throw("Match error")
111119 }
112120
113121 let factoryAddressOrFail = valueOrErrorMessage(factoryAddressOption, wrapErr("invalid factory address"))
114122
115123 let lpAssetIdOption = match factoryAddressOption {
116124 case a: Address =>
117125 match getString(a, keyLpAssetId()) {
118126 case s: String =>
119127 fromBase58String(s)
120128 case _: Unit =>
121129 unit
122130 case _ =>
123131 throw("Match error")
124132 }
125133 case _: Unit =>
126134 unit
127135 case _ =>
128136 throw("Match error")
129137 }
130138
131139 let lpAssetIdOrFail = valueOrErrorMessage(lpAssetIdOption, wrapErr("invalid lpAssetId"))
132140
141+let xtnAssetIdOption = match factoryAddressOption {
142+ case a: Address =>
143+ match getString(a, keyXtnAssetId()) {
144+ case s: String =>
145+ fromBase58String(s)
146+ case _: Unit =>
147+ unit
148+ case _ =>
149+ throw("Match error")
150+ }
151+ case _: Unit =>
152+ unit
153+ case _ =>
154+ throw("Match error")
155+}
156+
157+let xtnAssetIdOrFail = valueOrErrorMessage(xtnAssetIdOption, wrapErr("invalid xtnAssetId"))
158+
133159 let treasuryAddressOption = match factoryAddressOption {
134160 case a: Address =>
135161 match getString(a, keyTreasuryAddress()) {
136162 case s: String =>
137163 addressFromString(s)
138164 case _: Unit =>
139165 unit
140166 case _ =>
141167 throw("Match error")
142168 }
143169 case _: Unit =>
144170 unit
145171 case _ =>
146172 throw("Match error")
147173 }
148174
149175 let treasuryAddressOrFail = valueOrErrorMessage(treasuryAddressOption, wrapErr("invalid treasury address"))
150176
151177 func onlyAddress (i,address) = if ((i.caller == address))
152178 then true
153179 else throwErr("permission denied")
154180
155181
156182 func onlyFactory (i) = onlyAddress(i, factoryAddressOrFail)
157183
158184
159185 func rewardForOption (rewards,target) = {
160186 let s = size(rewards)
161- let $t036623687 = rewards[0]
162- let a0 = $t036623687._1
163- let r0 = $t036623687._2
164- let $t036903715 = rewards[1]
165- let a1 = $t036903715._1
166- let r1 = $t036903715._2
167- let $t037183743 = rewards[2]
168- let a2 = $t037183743._1
169- let r2 = $t037183743._2
187+ let $t040734098 = rewards[0]
188+ let a0 = $t040734098._1
189+ let r0 = $t040734098._2
190+ let $t041014126 = rewards[1]
191+ let a1 = $t041014126._1
192+ let r1 = $t041014126._2
193+ let $t041294154 = rewards[2]
194+ let a2 = $t041294154._1
195+ let r2 = $t041294154._2
170196 if (if ((s > 0))
171197 then (a0 == target)
172198 else false)
173199 then r0
174200 else if (if ((s > 1))
175201 then (a1 == target)
176202 else false)
177203 then r1
178204 else if (if ((s > 2))
179205 then (a2 == target)
180206 else false)
181207 then r2
182208 else unit
183209 }
184210
185211
186212 @Callable(i)
187213 func claimLP (userAddressBytes) = {
188214 let checkCaller = onlyFactory(i)
189215 if ((checkCaller == checkCaller))
190216 then {
191217 let userAddress = Address(userAddressBytes)
192218 let available = valueOrElse(getInteger(factoryAddressOrFail, keyAvailable(userAddress)), 0)
193219 let claimed = valueOrElse(getInteger(factoryAddressOrFail, keyClaimed(userAddress)), 0)
194220 let factoryActions = if ((available > 0))
195- then [invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, available, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(userAddress), 0], nil), invoke(factoryAddressOrFail, "stringEntry", [keyClaimed(userAddress), (claimed + available)], nil)]
221+ then [invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, available, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(userAddress), 0], nil), invoke(factoryAddressOrFail, "integerEntry", [keyClaimed(userAddress), (claimed + available)], nil)]
196222 else throwErr("nothing to claim")
197223 $Tuple2(nil, factoryActions)
198224 }
199225 else throw("Strict value is not equal to itself.")
200226 }
201227
202228
203229
204230 @Callable(i)
205-func finalize (newTreasuryVolumeInWaves,xtnPrice,pwrManagersBonus,treasuryVolumeDiffAllocationCoef) = {
206- let checks = [if ((i.originCaller == factoryAddressOrFail))
207- then true
208- else throwErr("permission denied"), if ((newTreasuryVolumeInWaves >= 0))
209- then true
210- else throwErr("invalid new treasury volume"), if ((xtnPrice >= 0))
211- then true
212- else throwErr("invalid XTN price"), if (if ((pwrManagersBonus >= 0))
213- then (SCALE8 >= pwrManagersBonus)
214- else false)
215- then true
216- else throwErr("invalid PWR managers bonus"), if (if ((treasuryVolumeDiffAllocationCoef >= -(SCALE8)))
217- then (SCALE8 >= treasuryVolumeDiffAllocationCoef)
218- else false)
219- then true
220- else throwErr("invalid treasury volume diff allocation coefficient")]
221- if ((checks == checks))
231+func finalize (userAddressBytes,newTreasuryVolumeInWaves,xtnPrice,pwrManagersBonus,treasuryVolumeDiffAllocationCoef) = {
232+ let checkCaller = onlyFactory(i)
233+ if ((checkCaller == checkCaller))
222234 then {
223235 let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period"))
224- let newPeriod = (currentPeriodOrFail + 1)
225- let newPrice = SCALE8
226- let lpAssetAmountToBurn = 0
227- let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyCurrentPeriod(), newPeriod], nil), invoke(factoryAddressOrFail, "integerEntry", [keyPriceForPeriod(newPeriod), newPrice], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmountToBurn], nil)]
228- $Tuple2(nil, factoryActions)
236+ let periodLength = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPeriodLength()), wrapErr("invalid period length"))
237+ let currentStartHeight = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyStartHeight(currentPeriodOrFail)), wrapErr("invalid start height"))
238+ let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price"))
239+ let nextBlockToProcess = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyNextBlockToProcess()), wrapErr("invalid next block to process"))
240+ let periodEndHeight = ((currentStartHeight + periodLength) - 1)
241+ let checks = [if ((nextBlockToProcess > periodEndHeight))
242+ then true
243+ else throwErr("unprocessed blocks"), if ((newTreasuryVolumeInWaves >= 0))
244+ then true
245+ else throwErr("invalid new treasury volume"), if ((xtnPrice >= 0))
246+ then true
247+ else throwErr("invalid XTN price"), if (if ((pwrManagersBonus >= 0))
248+ then (SCALE8 >= pwrManagersBonus)
249+ else false)
250+ then true
251+ else throwErr("invalid PWR managers bonus"), if (if ((treasuryVolumeDiffAllocationCoef >= -(SCALE8)))
252+ then (SCALE8 >= treasuryVolumeDiffAllocationCoef)
253+ else false)
254+ then true
255+ else throwErr("invalid treasury volume diff allocation coefficient")]
256+ if ((checks == checks))
257+ then {
258+ let investedXtnAmount = valueOrElse(getInteger(factoryAddressOrFail, keyInvested(xtnAssetIdOrFail)), 0)
259+ let investedWavesAmount = valueOrElse(getInteger(factoryAddressOrFail, keyInvested(unit)), 0)
260+ let investedXtnAmountInWaves = fraction(investedXtnAmount, xtnPrice, SCALE8)
261+ let currentTreasuryVolumeInWaves = (investedXtnAmountInWaves + investedWavesAmount)
262+ let profitRaw = (newTreasuryVolumeInWaves - currentTreasuryVolumeInWaves)
263+ let pwrManagersBonusAmount = if ((profitRaw > 0))
264+ then fraction(profitRaw, pwrManagersBonus, SCALE8)
265+ else 0
266+ let profit = (profitRaw - pwrManagersBonusAmount)
267+ let donationPart = if ((currentTreasuryVolumeInWaves > 0))
268+ then fraction(investedXtnAmountInWaves, SCALE8, currentTreasuryVolumeInWaves)
269+ else 0
270+ let donationProfitPartRaw = fraction(profit, donationPart, SCALE8)
271+ let investmentProfitPartRaw = (profit - donationProfitPartRaw)
272+ let treasuryVolumeDiffAllocationCoefAbs = abs(treasuryVolumeDiffAllocationCoef)
273+ let amountToDonation = fraction(investmentProfitPartRaw, if ((0 > treasuryVolumeDiffAllocationCoef))
274+ then treasuryVolumeDiffAllocationCoefAbs
275+ else 0, SCALE8)
276+ let amountToInvestment = fraction(donationProfitPartRaw, if ((treasuryVolumeDiffAllocationCoef > 0))
277+ then treasuryVolumeDiffAllocationCoefAbs
278+ else 0, SCALE8)
279+ let donationProfitPart = ((donationProfitPartRaw - amountToInvestment) + amountToDonation)
280+ let investmentProfitPart = ((investmentProfitPartRaw - amountToDonation) + amountToInvestment)
281+ let investedWavesAmountNew = (investedWavesAmount + investmentProfitPart)
282+ let investedXtnAmountNew = fraction((investedXtnAmountInWaves + donationProfitPart), SCALE8, xtnPrice)
283+ let newPeriod = (currentPeriodOrFail + 1)
284+ let lpAssetQuantity = valueOrErrorMessage(assetInfo(lpAssetIdOrFail), wrapErr("invalid lpAsset info")).quantity
285+ let newPrice = fraction(investedWavesAmountNew, SCALE8, lpAssetQuantity)
286+ let lpAssetAmountToBurn = valueOrElse(getInteger(factoryAddressOrFail, keyWithdrawal()), 0)
287+ let paymentAmountMin = fraction(lpAssetAmountToBurn, newPrice, SCALE8)
288+ let checkPaymentAmount = if (if (if ((size(i.payments) == 1))
289+ then (i.payments[0].assetId == unit)
290+ else false)
291+ then (i.payments[0].amount >= paymentAmountMin)
292+ else false)
293+ then true
294+ else throwErr(("invalid payments, payment amount min: " + toString(paymentAmountMin)))
295+ if ((checkPaymentAmount == checkPaymentAmount))
296+ then {
297+ let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyCurrentPeriod(), newPeriod], nil), invoke(factoryAddressOrFail, "integerEntry", [keyPriceForPeriod(newPeriod), newPrice], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmountToBurn], nil), invoke(factoryAddressOrFail, "integerEntry", [keyWithdrawal(), 0], nil)]
298+ $Tuple2(nil, factoryActions)
299+ }
300+ else throw("Strict value is not equal to itself.")
301+ }
302+ else throw("Strict value is not equal to itself.")
229303 }
230304 else throw("Strict value is not equal to itself.")
231305 }
232306
233307
234308
235309 @Callable(i)
236310 func invest (userAddressBytes) = {
237311 let checkCaller = onlyFactory(i)
238312 if ((checkCaller == checkCaller))
239313 then {
240314 let userAddress = Address(userAddressBytes)
241315 let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period"))
242316 let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price"))
243317 let payment = if ((size(i.payments) == 1))
244318 then i.payments[0]
245319 else throwErr("invalid payments")
246320 let paymentAmount = if (if ((payment.assetId == unit))
247321 then (payment.amount > 0)
248322 else false)
249323 then payment.amount
250324 else throwErr("invalid payment amount")
251325 let lpAssetAmount = if ((currentPriceOrFail > 0))
252326 then fraction(paymentAmount, SCALE8, currentPriceOrFail)
253327 else 0
254328 let invested = valueOrElse(getInteger(factoryAddressOrFail, keyInvested(unit)), 0)
255329 let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyInvested(unit), (invested + paymentAmount)], nil), invoke(factoryAddressOrFail, "reissue", [lpAssetAmount], nil), invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, lpAssetAmount, lpAssetIdOrFail], nil), invoke(factoryAddressOrFail, "transferWaves", [treasuryAddressOrFail.bytes, paymentAmount], [AttachedPayment(unit, paymentAmount)])]
256330 $Tuple2(nil, factoryActions)
257331 }
258332 else throw("Strict value is not equal to itself.")
259333 }
260334
261335
262336
263337 @Callable(i)
264338 func withdraw (userAddressBytes) = {
265339 let checkCaller = onlyFactory(i)
266340 if ((checkCaller == checkCaller))
267341 then {
268342 let userAddress = Address(userAddressBytes)
269343 let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period"))
270344 let payment = if ((size(i.payments) == 1))
271345 then i.payments[0]
272346 else throwErr(wrapErr("invalid payments"))
273347 let paymentAssetId = if ((payment.assetId == lpAssetIdOrFail))
274348 then lpAssetIdOrFail
275349 else throwErr("invalid payment asset")
276350 let paymentAmount = if ((payment.amount > 0))
277351 then payment.amount
278352 else throwErr("invalid payment amount")
279353 let withdrawal = valueOrElse(getInteger(factoryAddressOrFail, keyWithdrawal()), 0)
280354 let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyWithdrawal(), (withdrawal + paymentAmount)], nil), invoke(factoryAddressOrFail, "stringEntry", [keyWithdrawalRequest(userAddress, i.transactionId), valueWithdrawalRequest(PENDING, paymentAmount, (currentPeriodOrFail + 1), unit)], nil)]
281355 if ((factoryActions == factoryActions))
282356 then $Tuple2([ScriptTransfer(factoryAddressOrFail, paymentAmount, paymentAssetId)], factoryActions)
283357 else throw("Strict value is not equal to itself.")
284358 }
285359 else throw("Strict value is not equal to itself.")
286360 }
287361
288362
289363
290364 @Callable(i)
291365 func cancelWithdraw (userAddressBytes,txId) = {
292366 let checkCaller = onlyFactory(i)
293367 if ((checkCaller == checkCaller))
294368 then {
295369 let userAddress = Address(userAddressBytes)
296370 let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request"))
297- let $t093229435 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption)
298- let status = $t093229435._1
299- let lpAssetAmount = $t093229435._2
300- let targetPeriod = $t093229435._3
301- let claimTxId = $t093229435._4
302- if ((status == PENDING))
371+ let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period"))
372+ let $t01271312826 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption)
373+ let status = $t01271312826._1
374+ let lpAssetAmount = $t01271312826._2
375+ let targetPeriod = $t01271312826._3
376+ let claimTxId = $t01271312826._4
377+ let checks = [if ((status == PENDING))
378+ then true
379+ else throwErr("invalid withdrawal request status"), if ((targetPeriod > currentPeriodOrFail))
380+ then true
381+ else throwErr("invalid withdrawal request period")]
382+ if ((checks == checks))
303383 then {
304384 let withdrawal = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyWithdrawal()), wrapErr("invalid total withdrawal amount"))
305385 let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyWithdrawal(), if ((withdrawal >= lpAssetAmount))
306386 then (withdrawal - lpAssetAmount)
307387 else throwErr("invalid withdrawal amount")], nil), invoke(factoryAddressOrFail, "deleteEntry", [keyWithdrawalRequest(userAddress, txId)], nil), invoke(factoryAddressOrFail, "transferAsset", [userAddressBytes, lpAssetAmount, lpAssetIdOrFail], nil)]
308388 if ((factoryActions == factoryActions))
309389 then $Tuple2(nil, factoryActions)
310390 else throw("Strict value is not equal to itself.")
311391 }
312- else throwErr("invalid withdrawal request status")
392+ else throw("Strict value is not equal to itself.")
313393 }
314394 else throw("Strict value is not equal to itself.")
315395 }
316396
317397
318398
319399 @Callable(i)
320400 func claimWaves (userAddressBytes,txId) = {
321401 let checkCaller = onlyFactory(i)
322402 if ((checkCaller == checkCaller))
323403 then {
324404 let userAddress = Address(userAddressBytes)
325405 let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period"))
326406 let withdrawalRequestOption = valueOrErrorMessage(getString(factoryAddressOrFail, keyWithdrawalRequest(userAddress, txId)), wrapErr("invalid withdrawal request"))
327- let $t01071510828 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption)
328- let status = $t01071510828._1
329- let lpAssetAmount = $t01071510828._2
330- let targetPeriod = $t01071510828._3
331- let claimTxId = $t01071510828._4
407+ let $t01415814271 = parseWithdrawalRequestValueOrFail(withdrawalRequestOption)
408+ let status = $t01415814271._1
409+ let lpAssetAmount = $t01415814271._2
410+ let targetPeriod = $t01415814271._3
411+ let claimTxId = $t01415814271._4
332412 if ((status == FINISHED))
333413 then throwErr("invalid withdrawal request status")
334414 else if ((targetPeriod > currentPeriodOrFail))
335415 then throwErr("invalid withdrawal request period")
336416 else {
337- let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price"))
338- let amount = if ((currentPriceOrFail > 0))
339- then fraction(lpAssetAmount, currentPriceOrFail, SCALE8)
417+ let priceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(targetPeriod)), wrapErr("invalid price"))
418+ let amount = if ((priceOrFail > 0))
419+ then fraction(lpAssetAmount, priceOrFail, SCALE8)
340420 else 0
341421 let factoryActions = [invoke(factoryAddressOrFail, "stringEntry", [keyWithdrawalRequest(userAddress, txId), valueWithdrawalRequest(FINISHED, lpAssetAmount, targetPeriod, i.transactionId)], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmount], nil), invoke(factoryAddressOrFail, "transferWaves", [userAddressBytes, amount], nil)]
342422 $Tuple2(nil, factoryActions)
343423 }
344424 }
345425 else throw("Strict value is not equal to itself.")
346426 }
347427
348428
349429
350430 @Callable(i)
351431 func processBlocks (userAddressBytes) = {
352432 let checkCaller = onlyFactory(i)
353433 if ((checkCaller == checkCaller))
354434 then {
355435 let userAddress = Address(userAddressBytes)
356436 let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period"))
357437 let periodLength = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPeriodLength()), wrapErr("invalid period length"))
358438 let currentStartHeight = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyStartHeight(currentPeriodOrFail)), wrapErr("invalid start height"))
359439 let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price"))
360440 let nextBlockToProcess = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyNextBlockToProcess()), wrapErr("invalid next block to process"))
361441 let periodEndHeight = ((currentStartHeight + periodLength) - 1)
362442 let blocksProcessingBatchSizeMax = 40
363443 let blocksProcessingBatchSize = if (if (if ((height >= nextBlockToProcess))
364444 then if ((nextBlockToProcess >= currentStartHeight))
365445 then true
366446 else (currentPeriodOrFail == 0)
367447 else false)
368448 then (periodEndHeight >= nextBlockToProcess)
369449 else false)
370450 then min([((periodEndHeight - nextBlockToProcess) + 1), blocksProcessingBatchSizeMax])
371451 else throwErr(wrapErr("invalid target block"))
372452 let blockProcessingReward = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyBlockProcessingReward()), wrapErr("invalid block processing reward"))
373453 let blockProcessingRewardByGenerator = (blockProcessingReward / blocksProcessingBatchSize)
374454 let blockProcessingRewardByGeneratorRemainder = (blockProcessingReward - (blockProcessingRewardByGenerator * blocksProcessingBatchSize))
375455 func map (acc,inc) = if ((inc >= blocksProcessingBatchSize))
376456 then acc
377457 else {
378458 let targetBlockHeight = (nextBlockToProcess + inc)
379459 let targetBlockInfo = valueOrErrorMessage(blockInfoByHeight(targetBlockHeight), wrapErr("invalid block info"))
380460 let treasuryRewardOrFail = valueOrErrorMessage(rewardForOption(targetBlockInfo.rewards, treasuryAddressOrFail), wrapErr(("invalid treasury reward for height " + toString(targetBlockHeight))))
381461 let generator = targetBlockInfo.generator
382462 let available = valueOrElse(getInteger(factoryAddressOrFail, keyAvailable(generator)), 0)
383463 let callerReward = if ((inc == (blocksProcessingBatchSize - 1)))
384464 then (blockProcessingRewardByGenerator + blockProcessingRewardByGeneratorRemainder)
385465 else blockProcessingRewardByGenerator
386466 let lpAssetAmount = if ((currentPriceOrFail > 0))
387467 then fraction((treasuryRewardOrFail - callerReward), SCALE8, currentPriceOrFail)
388468 else 0
389469 let factoryActionsSingle = [invoke(factoryAddressOrFail, "stringEntry", [keyBlockProcessed(targetBlockHeight), makeString([toBase58String(i.transactionId), toBase58String(userAddressBytes), toString(treasuryRewardOrFail), toString(callerReward), toString(lpAssetAmount)], SEP)], nil), invoke(factoryAddressOrFail, "integerEntry", [keyAvailable(generator), (available + lpAssetAmount)], nil)]
390470 if ((factoryActionsSingle == factoryActionsSingle))
391471 then (acc + lpAssetAmount)
392472 else throw("Strict value is not equal to itself.")
393473 }
394474
395475 let list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39]
396476 let lpAssetAmountTotal = {
397477 let $l = list
398478 let $s = size($l)
399479 let $acc0 = 0
400480 func $f0_1 ($a,$i) = if (($i >= $s))
401481 then $a
402482 else map($a, $l[$i])
403483
404484 func $f0_2 ($a,$i) = if (($i >= $s))
405485 then $a
406486 else throw("List size exceeds 40")
407487
408488 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40)
409489 }
410490 if ((lpAssetAmountTotal == lpAssetAmountTotal))
411491 then {
412492 let actions = [invoke(factoryAddressOrFail, "transferWaves", [userAddressBytes, blockProcessingReward], nil), invoke(factoryAddressOrFail, "reissue", [lpAssetAmountTotal], nil), invoke(factoryAddressOrFail, "integerEntry", [keyNextBlockToProcess(), (nextBlockToProcess + blocksProcessingBatchSize)], nil)]
413493 if ((actions == actions))
414494 then $Tuple2(nil, unit)
415495 else throw("Strict value is not equal to itself.")
416496 }
417497 else throw("Strict value is not equal to itself.")
418498 }
419499 else throw("Strict value is not equal to itself.")
420500 }
421501
422502
423503 @Verifier(tx)
424504 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
425505

github/deemru/w8io/026f985 
85.77 ms