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