tx · 8DdYYNN1NFHZnMENXsWG6SSXmQZLanCoKXPMp65CLgkv 3N9wLKKtDBphos7U3xzsPqgvJJ5zPQEU6pV: -0.01300000 Waves 2023.07.06 11:26 [2653809] smart account 3N9wLKKtDBphos7U3xzsPqgvJJ5zPQEU6pV > SELF 0.00000000 Waves
{ "type": 13, "id": "8DdYYNN1NFHZnMENXsWG6SSXmQZLanCoKXPMp65CLgkv", "fee": 1300000, "feeAssetId": null, "timestamp": 1688632023980, "version": 1, "sender": "3N9wLKKtDBphos7U3xzsPqgvJJ5zPQEU6pV", "senderPublicKey": "GKX7DbVJVEtTB6ak3PXWHNPUhC3jym3ozbtZ7a36rGu6", "proofs": [ "3bSWydxWWbRtZqxGBoyfES3NqDDgwtjHMYwrC2gqY8iRfCU2Xgxzzsf8Lz64Hs2rNaimzexP8X1QEEBsUSLEYYwd" ], "script": "base64:BgIKCAISBgoEAgEBASwAA1NFUAICX18ADUNPTlRSQUNUX05BTUUCD2NhbGN1bGF0b3IucmlkZQAGU0NBTEU4AIDC1y8AB1BFTkRJTkcCB1BFTkRJTkcACEZJTklTSEVEAghGSU5JU0hFRAAFV0FWRVMCBVdBVkVTAQd3cmFwRXJyAQFzCQCsAgIJAKwCAgUNQ09OVFJBQ1RfTkFNRQICOiAFAXMBCHRocm93RXJyAQFzCQACAQkBB3dyYXBFcnIBBQFzAQ9hc3NldElkVG9TdHJpbmcBB2Fzc2V0SWQEByRtYXRjaDAFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQBYgUHJG1hdGNoMAkA2AQBBQFiAwkAAQIFByRtYXRjaDACBFVuaXQFBVdBVkVTCQACAQILTWF0Y2ggZXJyb3IBA2FicwEBbgMJAGYCAAAFAW4JAQEtAQUBbgUBbgERa2V5RmFjdG9yeUFkZHJlc3MACQC5CQIJAMwIAgICJXMJAMwIAgIHZmFjdG9yeQUDbmlsBQNTRVABE2tleU1hbmFnZXJQdWJsaWNLZXkACQC5CQIJAMw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chainId": 84, "height": 2653809, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B2K7kQfptcWhnEpbWULCVwZbwkveix5Pb3yeVoQyCgc2 Next: 5Zw1JHvQr7soHtAaHjxUzGsgXK43wpqmjjdvmAo6Yrwt Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SEP = "__" | |
5 | + | ||
6 | + | let CONTRACT_NAME = "calculator.ride" | |
7 | + | ||
8 | + | let SCALE8 = 100000000 | |
9 | + | ||
10 | + | let PENDING = "PENDING" | |
11 | + | ||
12 | + | let FINISHED = "FINISHED" | |
13 | + | ||
14 | + | let WAVES = "WAVES" | |
15 | + | ||
16 | + | func wrapErr (s) = ((CONTRACT_NAME + ": ") + s) | |
17 | + | ||
18 | + | ||
19 | + | func throwErr (s) = throw(wrapErr(s)) | |
20 | + | ||
21 | + | ||
22 | + | func assetIdToString (assetId) = match assetId { | |
23 | + | case b: ByteVector => | |
24 | + | toBase58String(b) | |
25 | + | case _: Unit => | |
26 | + | WAVES | |
27 | + | case _ => | |
28 | + | throw("Match error") | |
29 | + | } | |
30 | + | ||
31 | + | ||
32 | + | func abs (n) = if ((0 > n)) | |
33 | + | then -(n) | |
34 | + | else n | |
35 | + | ||
36 | + | ||
37 | + | func keyFactoryAddress () = makeString(["%s", "factory"], SEP) | |
38 | + | ||
39 | + | ||
40 | + | func keyManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP) | |
41 | + | ||
42 | + | ||
43 | + | func keyLpAssetId () = makeString(["%s", "lpAssetId"], SEP) | |
44 | + | ||
45 | + | ||
46 | + | func keyProxyTreasuryAddress () = makeString(["%s", "proxyTreasury"], SEP) | |
47 | + | ||
48 | + | ||
49 | + | func keyMainTreasuryAddress () = makeString(["%s", "mainTreasury"], SEP) | |
50 | + | ||
51 | + | ||
52 | + | func keyInvested (assetId) = makeString(["%s%s", "invested", assetIdToString(assetId)], SEP) | |
53 | + | ||
54 | + | ||
55 | + | func keyDonated (assetId) = makeString(["%s%s", "donated", assetIdToString(assetId)], SEP) | |
56 | + | ||
57 | + | ||
58 | + | func keyAvailable (userAddress) = makeString(["%s%s", "available", toString(userAddress)], SEP) | |
59 | + | ||
60 | + | ||
61 | + | func keyClaimed (userAddress) = makeString(["%s%s", "claimed", toString(userAddress)], SEP) | |
62 | + | ||
63 | + | ||
64 | + | func keyCurrentPeriod () = makeString(["%s", "currentPeriod"], SEP) | |
65 | + | ||
66 | + | ||
67 | + | func keyPriceForPeriod (period) = makeString(["%s%d", "price", toString(period)], SEP) | |
68 | + | ||
69 | + | ||
70 | + | func keyStartHeight (period) = makeString(["%s%d", "startHeight", toString(period)], SEP) | |
71 | + | ||
72 | + | ||
73 | + | func keyPowerManagerBonus (period) = makeString(["%s%d", "powerManagerBonus", toString(period)], SEP) | |
74 | + | ||
75 | + | ||
76 | + | func keyPeriodLength () = "%s__periodLength" | |
77 | + | ||
78 | + | ||
79 | + | func keyBlockProcessingReward () = "%s__blockProcessingReward" | |
80 | + | ||
81 | + | ||
82 | + | func keyNextBlockToProcess () = "%s__nextBlockToProcess" | |
83 | + | ||
84 | + | ||
85 | + | func keyBlockProcessed (height) = makeString(["%s%d", "blockProcessed", toString(height)], SEP) | |
86 | + | ||
87 | + | ||
88 | + | func keyWithdrawal () = "%s__withdrawal" | |
89 | + | ||
90 | + | ||
91 | + | func keyWithdrawalRequest (userAddress,txId) = makeString(["%s%s%s", "withdrawal", toString(userAddress), toBase58String(txId)], SEP) | |
92 | + | ||
93 | + | ||
94 | + | func valueWithdrawalRequest (status,lpAssetAmount,targetPeriod,claimTxId) = { | |
95 | + | let claimTxIdStr = match claimTxId { | |
96 | + | case b: ByteVector => | |
97 | + | toBase58String(b) | |
98 | + | case _: Unit => | |
99 | + | "SOON" | |
100 | + | case _ => | |
101 | + | throw("Match error") | |
102 | + | } | |
103 | + | makeString(["%s%d%d%s", status, toString(lpAssetAmount), toString(targetPeriod), claimTxIdStr], SEP) | |
104 | + | } | |
105 | + | ||
106 | + | ||
107 | + | func parseWithdrawalRequestValueOrFail (s) = { | |
108 | + | let parts = split(s, SEP) | |
109 | + | if ((size(parts) == 5)) | |
110 | + | then { | |
111 | + | let status = parts[1] | |
112 | + | let lpAssetAmount = valueOrErrorMessage(parseInt(parts[2]), wrapErr("invalid lpAssetAmount")) | |
113 | + | let targetPeriod = valueOrErrorMessage(parseInt(parts[3]), wrapErr("invalid targetPeriod")) | |
114 | + | let claimTxId = parts[4] | |
115 | + | $Tuple4(status, lpAssetAmount, targetPeriod, claimTxId) | |
116 | + | } | |
117 | + | else throwErr("invalid withdrawal request value") | |
118 | + | } | |
119 | + | ||
120 | + | ||
121 | + | let factoryAddressOption = match getString(this, keyFactoryAddress()) { | |
122 | + | case s: String => | |
123 | + | addressFromString(s) | |
124 | + | case _: Unit => | |
125 | + | unit | |
126 | + | case _ => | |
127 | + | throw("Match error") | |
128 | + | } | |
129 | + | ||
130 | + | let factoryAddressOrFail = valueOrErrorMessage(factoryAddressOption, wrapErr("invalid factory address")) | |
131 | + | ||
132 | + | let lpAssetIdOption = match factoryAddressOption { | |
133 | + | case a: Address => | |
134 | + | match getString(a, keyLpAssetId()) { | |
135 | + | case s: String => | |
136 | + | fromBase58String(s) | |
137 | + | case _: Unit => | |
138 | + | unit | |
139 | + | case _ => | |
140 | + | throw("Match error") | |
141 | + | } | |
142 | + | case _: Unit => | |
143 | + | unit | |
144 | + | case _ => | |
145 | + | throw("Match error") | |
146 | + | } | |
147 | + | ||
148 | + | let lpAssetIdOrFail = valueOrErrorMessage(lpAssetIdOption, wrapErr("invalid lpAssetId")) | |
149 | + | ||
150 | + | let proxyTreasuryAddressOption = match factoryAddressOption { | |
151 | + | case a: Address => | |
152 | + | match getString(a, keyProxyTreasuryAddress()) { | |
153 | + | case s: String => | |
154 | + | addressFromString(s) | |
155 | + | case _: Unit => | |
156 | + | unit | |
157 | + | case _ => | |
158 | + | throw("Match error") | |
159 | + | } | |
160 | + | case _: Unit => | |
161 | + | unit | |
162 | + | case _ => | |
163 | + | throw("Match error") | |
164 | + | } | |
165 | + | ||
166 | + | let proxyTreasuryAddressOrFail = valueOrErrorMessage(proxyTreasuryAddressOption, wrapErr("invalid proxy treasury address")) | |
167 | + | ||
168 | + | let mainTreasuryAddressOption = match factoryAddressOption { | |
169 | + | case a: Address => | |
170 | + | match getString(a, keyMainTreasuryAddress()) { | |
171 | + | case s: String => | |
172 | + | addressFromString(s) | |
173 | + | case _: Unit => | |
174 | + | unit | |
175 | + | case _ => | |
176 | + | throw("Match error") | |
177 | + | } | |
178 | + | case _: Unit => | |
179 | + | unit | |
180 | + | case _ => | |
181 | + | throw("Match error") | |
182 | + | } | |
183 | + | ||
184 | + | let mainTreasuryAddressOrFail = valueOrErrorMessage(mainTreasuryAddressOption, wrapErr("invalid main treasury address")) | |
185 | + | ||
186 | + | func getManagerPublicKeyOrUnit () = match factoryAddressOption { | |
187 | + | case fa: Address => | |
188 | + | match getString(fa, keyManagerPublicKey()) { | |
189 | + | case pub: String => | |
190 | + | fromBase58String(pub) | |
191 | + | case _ => | |
192 | + | unit | |
193 | + | } | |
194 | + | case _ => | |
195 | + | unit | |
196 | + | } | |
197 | + | ||
198 | + | ||
199 | + | func onlyAddress (i,address) = if ((i.caller == address)) | |
200 | + | then true | |
201 | + | else throwErr("permission denied") | |
202 | + | ||
203 | + | ||
204 | + | func onlyFactory (i) = onlyAddress(i, factoryAddressOrFail) | |
205 | + | ||
206 | + | ||
207 | + | func rewardForOption (rewards,target) = { | |
208 | + | let s = size(rewards) | |
209 | + | let $t047354760 = rewards[0] | |
210 | + | let a0 = $t047354760._1 | |
211 | + | let r0 = $t047354760._2 | |
212 | + | let $t047634788 = rewards[1] | |
213 | + | let a1 = $t047634788._1 | |
214 | + | let r1 = $t047634788._2 | |
215 | + | let $t047914816 = rewards[2] | |
216 | + | let a2 = $t047914816._1 | |
217 | + | let r2 = $t047914816._2 | |
218 | + | if (if ((s > 0)) | |
219 | + | then (a0 == target) | |
220 | + | else false) | |
221 | + | then r0 | |
222 | + | else if (if ((s > 1)) | |
223 | + | then (a1 == target) | |
224 | + | else false) | |
225 | + | then r1 | |
226 | + | else if (if ((s > 2)) | |
227 | + | then (a2 == target) | |
228 | + | else false) | |
229 | + | then r2 | |
230 | + | else unit | |
231 | + | } | |
232 | + | ||
233 | + | ||
234 | + | func finalizeINTERNAL (newTreasuryVolumeInWaves,pwrManagersBonusInWaves,treasuryVolumeDiffAllocationCoef) = { | |
235 | + | let donatedWavesAmount = valueOrElse(getInteger(factoryAddressOrFail, keyDonated(unit)), 0) | |
236 | + | let investedWavesAmount = valueOrElse(getInteger(factoryAddressOrFail, keyInvested(unit)), 0) | |
237 | + | let currentTreasuryVolumeInWaves = (donatedWavesAmount + investedWavesAmount) | |
238 | + | let profitRaw = (newTreasuryVolumeInWaves - currentTreasuryVolumeInWaves) | |
239 | + | let pwrManagersBonusAmount = if (if ((profitRaw > 0)) | |
240 | + | then (profitRaw >= pwrManagersBonusInWaves) | |
241 | + | else false) | |
242 | + | then pwrManagersBonusInWaves | |
243 | + | else throwErr("power bonus is more than profit") | |
244 | + | let profit = (profitRaw - pwrManagersBonusAmount) | |
245 | + | let donationPart = if ((currentTreasuryVolumeInWaves > 0)) | |
246 | + | then fraction(donatedWavesAmount, SCALE8, currentTreasuryVolumeInWaves) | |
247 | + | else 0 | |
248 | + | let donationProfitPartRaw = fraction(profit, donationPart, SCALE8) | |
249 | + | let investmentProfitPartRaw = (profit - donationProfitPartRaw) | |
250 | + | let treasuryVolumeDiffAllocationCoefAbs = abs(treasuryVolumeDiffAllocationCoef) | |
251 | + | let amountToDonation = fraction(investmentProfitPartRaw, if ((0 > treasuryVolumeDiffAllocationCoef)) | |
252 | + | then treasuryVolumeDiffAllocationCoefAbs | |
253 | + | else 0, SCALE8) | |
254 | + | let amountToInvestment = fraction(donationProfitPartRaw, if ((treasuryVolumeDiffAllocationCoef > 0)) | |
255 | + | then treasuryVolumeDiffAllocationCoefAbs | |
256 | + | else 0, SCALE8) | |
257 | + | let donationProfitPart = ((donationProfitPartRaw - amountToInvestment) + amountToDonation) | |
258 | + | let investmentProfitPart = ((investmentProfitPartRaw - amountToDonation) + amountToInvestment) | |
259 | + | let donatedWavesAmountNewRaw = (donatedWavesAmount + donationProfitPart) | |
260 | + | let investedWavesAmountNewRaw = (investedWavesAmount + investmentProfitPart) | |
261 | + | let donatedPartDebt = min([0, donatedWavesAmountNewRaw]) | |
262 | + | let investedPartDebt = min([0, investedWavesAmountNewRaw]) | |
263 | + | let donatedWavesAmountNew = (max([0, donatedWavesAmountNewRaw]) + investedPartDebt) | |
264 | + | let investedWavesAmountNew = (max([0, investedWavesAmountNewRaw]) + donatedPartDebt) | |
265 | + | let lpAssetQuantity = valueOrErrorMessage(assetInfo(lpAssetIdOrFail), wrapErr("invalid lpAsset info")).quantity | |
266 | + | let newPrice = fraction(investedWavesAmountNew, SCALE8, lpAssetQuantity) | |
267 | + | let checkIfPriceNotZero = if ((newPrice != 0)) | |
268 | + | then true | |
269 | + | else throwErr("LP price cannot be 0") | |
270 | + | if ((checkIfPriceNotZero == checkIfPriceNotZero)) | |
271 | + | then { | |
272 | + | let lpAssetAmountToBurn = valueOrElse(getInteger(factoryAddressOrFail, keyWithdrawal()), 0) | |
273 | + | let paymentAmountMin = max([0, fraction(lpAssetAmountToBurn, newPrice, SCALE8)]) | |
274 | + | let finalInvestedWavesAmount = (investedWavesAmountNew - paymentAmountMin) | |
275 | + | let lpAssetFinalQuantity = (lpAssetQuantity - lpAssetAmountToBurn) | |
276 | + | $Tuple6(paymentAmountMin, finalInvestedWavesAmount, donatedWavesAmountNew, newPrice, lpAssetAmountToBurn, lpAssetFinalQuantity) | |
277 | + | } | |
278 | + | else throw("Strict value is not equal to itself.") | |
279 | + | } | |
280 | + | ||
281 | + | ||
282 | + | @Callable(i) | |
283 | + | func finalize (userAddressBytes,newTreasuryVolumeInWaves,pwrManagersBonusInWaves,treasuryVolumeDiffAllocationCoef) = { | |
284 | + | let checkCaller = onlyFactory(i) | |
285 | + | if ((checkCaller == checkCaller)) | |
286 | + | then { | |
287 | + | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
288 | + | let periodLength = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPeriodLength()), wrapErr("invalid period length")) | |
289 | + | let currentStartHeight = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyStartHeight(currentPeriodOrFail)), wrapErr("invalid start height")) | |
290 | + | let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price")) | |
291 | + | let nextBlockToProcess = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyNextBlockToProcess()), wrapErr("invalid next block to process")) | |
292 | + | let periodEndHeight = ((currentStartHeight + periodLength) - 1) | |
293 | + | let checks = [if ((i.originCaller == mainTreasuryAddressOrFail)) | |
294 | + | then true | |
295 | + | else throwErr("permission denied"), if ((nextBlockToProcess > periodEndHeight)) | |
296 | + | then true | |
297 | + | else throwErr("unprocessed blocks"), if ((newTreasuryVolumeInWaves >= 0)) | |
298 | + | then true | |
299 | + | else throwErr("invalid new treasury volume"), if ((pwrManagersBonusInWaves >= 0)) | |
300 | + | then true | |
301 | + | else throwErr("invalid PWR managers bonus"), if (if ((treasuryVolumeDiffAllocationCoef >= -(SCALE8))) | |
302 | + | then (SCALE8 >= treasuryVolumeDiffAllocationCoef) | |
303 | + | else false) | |
304 | + | then true | |
305 | + | else throwErr("invalid treasury volume diff allocation coefficient")] | |
306 | + | if ((checks == checks)) | |
307 | + | then { | |
308 | + | let donatedWavesAmount = valueOrElse(getInteger(factoryAddressOrFail, keyDonated(unit)), 0) | |
309 | + | let investedWavesAmount = valueOrElse(getInteger(factoryAddressOrFail, keyInvested(unit)), 0) | |
310 | + | let currentTreasuryVolumeInWaves = (donatedWavesAmount + investedWavesAmount) | |
311 | + | let profitRaw = (newTreasuryVolumeInWaves - currentTreasuryVolumeInWaves) | |
312 | + | let pwrManagersBonusAmount = if (if ((profitRaw > 0)) | |
313 | + | then (profitRaw >= pwrManagersBonusInWaves) | |
314 | + | else false) | |
315 | + | then pwrManagersBonusInWaves | |
316 | + | else throwErr("power bonus is more than profit") | |
317 | + | let profit = (profitRaw - pwrManagersBonusAmount) | |
318 | + | let donationPart = if ((currentTreasuryVolumeInWaves > 0)) | |
319 | + | then fraction(donatedWavesAmount, SCALE8, currentTreasuryVolumeInWaves) | |
320 | + | else 0 | |
321 | + | let donationProfitPartRaw = fraction(profit, donationPart, SCALE8) | |
322 | + | let investmentProfitPartRaw = (profit - donationProfitPartRaw) | |
323 | + | let treasuryVolumeDiffAllocationCoefAbs = abs(treasuryVolumeDiffAllocationCoef) | |
324 | + | let amountToDonation = fraction(investmentProfitPartRaw, if ((0 > treasuryVolumeDiffAllocationCoef)) | |
325 | + | then treasuryVolumeDiffAllocationCoefAbs | |
326 | + | else 0, SCALE8) | |
327 | + | let amountToInvestment = fraction(donationProfitPartRaw, if ((treasuryVolumeDiffAllocationCoef > 0)) | |
328 | + | then treasuryVolumeDiffAllocationCoefAbs | |
329 | + | else 0, SCALE8) | |
330 | + | let donationProfitPart = ((donationProfitPartRaw - amountToInvestment) + amountToDonation) | |
331 | + | let investmentProfitPart = ((investmentProfitPartRaw - amountToDonation) + amountToInvestment) | |
332 | + | let donatedWavesAmountNewRaw = (donatedWavesAmount + donationProfitPart) | |
333 | + | let investedWavesAmountNewRaw = (investedWavesAmount + investmentProfitPart) | |
334 | + | let donatedPartDebt = min([0, donatedWavesAmountNewRaw]) | |
335 | + | let investedPartDebt = min([0, investedWavesAmountNewRaw]) | |
336 | + | let donatedWavesAmountNew = (max([0, donatedWavesAmountNewRaw]) + investedPartDebt) | |
337 | + | let investedWavesAmountNew = (max([0, investedWavesAmountNewRaw]) + donatedPartDebt) | |
338 | + | let newPeriod = (currentPeriodOrFail + 1) | |
339 | + | let lpAssetQuantity = valueOrErrorMessage(assetInfo(lpAssetIdOrFail), wrapErr("invalid lpAsset info")).quantity | |
340 | + | let newPrice = fraction(investedWavesAmountNew, SCALE8, lpAssetQuantity) | |
341 | + | let checkIfPriceNotZero = if ((newPrice != 0)) | |
342 | + | then true | |
343 | + | else throwErr("LP price cannot be 0") | |
344 | + | if ((checkIfPriceNotZero == checkIfPriceNotZero)) | |
345 | + | then { | |
346 | + | let lpAssetAmountToBurn = valueOrElse(getInteger(factoryAddressOrFail, keyWithdrawal()), 0) | |
347 | + | let paymentAmountMin = max([0, fraction(lpAssetAmountToBurn, newPrice, SCALE8)]) | |
348 | + | let paymentOption = if ((size(i.payments) > 0)) | |
349 | + | then i.payments[0] | |
350 | + | else unit | |
351 | + | let paymentAmount = value(paymentOption).amount | |
352 | + | let paymentAssetId = value(paymentOption).assetId | |
353 | + | let checkPayment = if (if ((paymentAmountMin == 0)) | |
354 | + | then true | |
355 | + | else if (if ((paymentOption != unit)) | |
356 | + | then (paymentAssetId == unit) | |
357 | + | else false) | |
358 | + | then (paymentAmount >= paymentAmountMin) | |
359 | + | else false) | |
360 | + | then true | |
361 | + | else throwErr(("invalid payments, payment amount min: " + toString(paymentAmountMin))) | |
362 | + | if ((checkPayment == checkPayment)) | |
363 | + | then { | |
364 | + | let actions = if ((paymentOption != unit)) | |
365 | + | then [ScriptTransfer(factoryAddressOrFail, paymentAmount, paymentAssetId)] | |
366 | + | else nil | |
367 | + | let factoryActions = [invoke(factoryAddressOrFail, "integerEntry", [keyPowerManagerBonus(currentPeriodOrFail), pwrManagersBonusAmount], nil), invoke(factoryAddressOrFail, "integerEntry", [keyCurrentPeriod(), newPeriod], nil), invoke(factoryAddressOrFail, "integerEntry", [keyPriceForPeriod(newPeriod), newPrice], nil), invoke(factoryAddressOrFail, "integerEntry", [keyStartHeight(newPeriod), (periodEndHeight + 1)], nil), invoke(factoryAddressOrFail, "burn", [lpAssetAmountToBurn], nil), invoke(factoryAddressOrFail, "integerEntry", [keyWithdrawal(), 0], nil), invoke(factoryAddressOrFail, "integerEntry", [keyInvested(unit), (investedWavesAmountNew - paymentAmountMin)], nil), invoke(factoryAddressOrFail, "integerEntry", [keyDonated(unit), donatedWavesAmountNew], nil)] | |
368 | + | $Tuple2(actions, factoryActions) | |
369 | + | } | |
370 | + | else throw("Strict value is not equal to itself.") | |
371 | + | } | |
372 | + | else throw("Strict value is not equal to itself.") | |
373 | + | } | |
374 | + | else throw("Strict value is not equal to itself.") | |
375 | + | } | |
376 | + | else throw("Strict value is not equal to itself.") | |
377 | + | } | |
378 | + | ||
379 | + |
github/deemru/w8io/026f985 31.26 ms ◑