tx · 5Zw1JHvQr7soHtAaHjxUzGsgXK43wpqmjjdvmAo6Yrwt 3N9wLKKtDBphos7U3xzsPqgvJJ5zPQEU6pV: -0.01300000 Waves 2023.07.06 11:32 [2653815] smart account 3N9wLKKtDBphos7U3xzsPqgvJJ5zPQEU6pV > SELF 0.00000000 Waves
{ "type": 13, "id": "5Zw1JHvQr7soHtAaHjxUzGsgXK43wpqmjjdvmAo6Yrwt", "fee": 1300000, "feeAssetId": null, "timestamp": 1688632362200, "version": 1, "sender": "3N9wLKKtDBphos7U3xzsPqgvJJ5zPQEU6pV", "senderPublicKey": "GKX7DbVJVEtTB6ak3PXWHNPUhC3jym3ozbtZ7a36rGu6", "proofs": [ "2d85SRnZFEEgf6a9LTU7gcor4DNWSwXnFKT9jkJBobanz3QwyM7ELnKkXPUVbC1eFWvJRYDYAoHWQv7uzFHjZEaN" ], "script": "base64:BgIKCAISBgoEAgEBASwAA1NFUAICX18ADUNPTlRSQUNUX05BTUUCD2NhbGN1bGF0b3IucmlkZQAGU0NBTEU4AIDC1y8AB1BFTkRJTkcCB1BFTkRJTkcACEZJTklTSEVEAghGSU5JU0hFRAAFV0FWRVMCBVdBVkVTAQd3cmFwRXJyAQFzCQCsAgIJAKwCAgUNQ09OVFJBQ1RfTkFNRQICOiAFAXMBCHRocm93RXJyAQFzCQACAQkBB3dyYXBFcnIBBQFzAQ9hc3NldElkVG9TdHJpbmcBB2Fzc2V0SWQEByRtYXRjaDAFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQBYgUHJG1hdGNoMAkA2AQBBQFiAwkAAQIFByRtYXRjaDACBFVuaXQFBVdBVkVTCQACAQILTWF0Y2ggZXJyb3IBA2FicwEBbgMJAGYCAAAFAW4JAQEtAQUBbgUBbgERa2V5RmFjdG9yeUFkZHJlc3MACQC5CQIJAMwIAgICJXMJAMwIAgIHZmFjdG9yeQUDbmlsBQNTRVABE2tleU1hbmFnZXJQdWJsaWNLZXkACQC5CQI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2653815, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8DdYYNN1NFHZnMENXsWG6SSXmQZLanCoKXPMp65CLgkv Next: FmL5cQAV3bZMxYNPbfDPzbJGCiv9yQ9ktyTGvN34yqqc 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 (if ((profitRaw > 0)) | |
240 | - | then (profitRaw >= pwrManagersBonusInWaves) | |
241 | - | else false) | |
239 | + | let pwrManagersBonusAmount = if ((profitRaw >= pwrManagersBonusInWaves)) | |
242 | 240 | then pwrManagersBonusInWaves | |
243 | 241 | else throwErr("power bonus is more than profit") | |
244 | 242 | 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 (if ((profitRaw > 0)) | |
240 | - | then (profitRaw >= pwrManagersBonusInWaves) | |
241 | - | else false) | |
239 | + | let pwrManagersBonusAmount = if ((profitRaw >= pwrManagersBonusInWaves)) | |
242 | 240 | then pwrManagersBonusInWaves | |
243 | 241 | else throwErr("power bonus is more than profit") | |
244 | 242 | let profit = (profitRaw - pwrManagersBonusAmount) | |
245 | 243 | let donationPart = if ((currentTreasuryVolumeInWaves > 0)) | |
246 | 244 | then fraction(donatedWavesAmount, SCALE8, currentTreasuryVolumeInWaves) | |
247 | 245 | else 0 | |
248 | 246 | let donationProfitPartRaw = fraction(profit, donationPart, SCALE8) | |
249 | 247 | let investmentProfitPartRaw = (profit - donationProfitPartRaw) | |
250 | 248 | let treasuryVolumeDiffAllocationCoefAbs = abs(treasuryVolumeDiffAllocationCoef) | |
251 | 249 | let amountToDonation = fraction(investmentProfitPartRaw, if ((0 > treasuryVolumeDiffAllocationCoef)) | |
252 | 250 | then treasuryVolumeDiffAllocationCoefAbs | |
253 | 251 | else 0, SCALE8) | |
254 | 252 | let amountToInvestment = fraction(donationProfitPartRaw, if ((treasuryVolumeDiffAllocationCoef > 0)) | |
255 | 253 | then treasuryVolumeDiffAllocationCoefAbs | |
256 | 254 | else 0, SCALE8) | |
257 | 255 | let donationProfitPart = ((donationProfitPartRaw - amountToInvestment) + amountToDonation) | |
258 | 256 | let investmentProfitPart = ((investmentProfitPartRaw - amountToDonation) + amountToInvestment) | |
259 | 257 | let donatedWavesAmountNewRaw = (donatedWavesAmount + donationProfitPart) | |
260 | 258 | let investedWavesAmountNewRaw = (investedWavesAmount + investmentProfitPart) | |
261 | 259 | let donatedPartDebt = min([0, donatedWavesAmountNewRaw]) | |
262 | 260 | let investedPartDebt = min([0, investedWavesAmountNewRaw]) | |
263 | 261 | let donatedWavesAmountNew = (max([0, donatedWavesAmountNewRaw]) + investedPartDebt) | |
264 | 262 | let investedWavesAmountNew = (max([0, investedWavesAmountNewRaw]) + donatedPartDebt) | |
265 | 263 | let lpAssetQuantity = valueOrErrorMessage(assetInfo(lpAssetIdOrFail), wrapErr("invalid lpAsset info")).quantity | |
266 | 264 | let newPrice = fraction(investedWavesAmountNew, SCALE8, lpAssetQuantity) | |
267 | 265 | let checkIfPriceNotZero = if ((newPrice != 0)) | |
268 | 266 | then true | |
269 | 267 | else throwErr("LP price cannot be 0") | |
270 | 268 | if ((checkIfPriceNotZero == checkIfPriceNotZero)) | |
271 | 269 | then { | |
272 | 270 | let lpAssetAmountToBurn = valueOrElse(getInteger(factoryAddressOrFail, keyWithdrawal()), 0) | |
273 | 271 | let paymentAmountMin = max([0, fraction(lpAssetAmountToBurn, newPrice, SCALE8)]) | |
274 | 272 | let finalInvestedWavesAmount = (investedWavesAmountNew - paymentAmountMin) | |
275 | 273 | let lpAssetFinalQuantity = (lpAssetQuantity - lpAssetAmountToBurn) | |
276 | 274 | $Tuple6(paymentAmountMin, finalInvestedWavesAmount, donatedWavesAmountNew, newPrice, lpAssetAmountToBurn, lpAssetFinalQuantity) | |
277 | 275 | } | |
278 | 276 | else throw("Strict value is not equal to itself.") | |
279 | 277 | } | |
280 | 278 | ||
281 | 279 | ||
282 | 280 | @Callable(i) | |
283 | 281 | func finalize (userAddressBytes,newTreasuryVolumeInWaves,pwrManagersBonusInWaves,treasuryVolumeDiffAllocationCoef) = { | |
284 | 282 | let checkCaller = onlyFactory(i) | |
285 | 283 | if ((checkCaller == checkCaller)) | |
286 | 284 | then { | |
287 | 285 | let currentPeriodOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyCurrentPeriod()), wrapErr("invalid period")) | |
288 | 286 | let periodLength = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPeriodLength()), wrapErr("invalid period length")) | |
289 | 287 | let currentStartHeight = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyStartHeight(currentPeriodOrFail)), wrapErr("invalid start height")) | |
290 | 288 | let currentPriceOrFail = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyPriceForPeriod(currentPeriodOrFail)), wrapErr("invalid price")) | |
291 | 289 | let nextBlockToProcess = valueOrErrorMessage(getInteger(factoryAddressOrFail, keyNextBlockToProcess()), wrapErr("invalid next block to process")) | |
292 | 290 | let periodEndHeight = ((currentStartHeight + periodLength) - 1) | |
293 | 291 | let checks = [if ((i.originCaller == mainTreasuryAddressOrFail)) | |
294 | 292 | then true | |
295 | 293 | else throwErr("permission denied"), if ((nextBlockToProcess > periodEndHeight)) | |
296 | 294 | then true | |
297 | 295 | else throwErr("unprocessed blocks"), if ((newTreasuryVolumeInWaves >= 0)) | |
298 | 296 | then true | |
299 | 297 | else throwErr("invalid new treasury volume"), if ((pwrManagersBonusInWaves >= 0)) | |
300 | 298 | then true | |
301 | 299 | else throwErr("invalid PWR managers bonus"), if (if ((treasuryVolumeDiffAllocationCoef >= -(SCALE8))) | |
302 | 300 | then (SCALE8 >= treasuryVolumeDiffAllocationCoef) | |
303 | 301 | else false) | |
304 | 302 | then true | |
305 | 303 | else throwErr("invalid treasury volume diff allocation coefficient")] | |
306 | 304 | if ((checks == checks)) | |
307 | 305 | then { | |
308 | 306 | let donatedWavesAmount = valueOrElse(getInteger(factoryAddressOrFail, keyDonated(unit)), 0) | |
309 | 307 | let investedWavesAmount = valueOrElse(getInteger(factoryAddressOrFail, keyInvested(unit)), 0) | |
310 | 308 | let currentTreasuryVolumeInWaves = (donatedWavesAmount + investedWavesAmount) | |
311 | 309 | let profitRaw = (newTreasuryVolumeInWaves - currentTreasuryVolumeInWaves) | |
312 | 310 | let pwrManagersBonusAmount = if (if ((profitRaw > 0)) | |
313 | 311 | then (profitRaw >= pwrManagersBonusInWaves) | |
314 | 312 | else false) | |
315 | 313 | then pwrManagersBonusInWaves | |
316 | 314 | else throwErr("power bonus is more than profit") | |
317 | 315 | let profit = (profitRaw - pwrManagersBonusAmount) | |
318 | 316 | let donationPart = if ((currentTreasuryVolumeInWaves > 0)) | |
319 | 317 | then fraction(donatedWavesAmount, SCALE8, currentTreasuryVolumeInWaves) | |
320 | 318 | else 0 | |
321 | 319 | let donationProfitPartRaw = fraction(profit, donationPart, SCALE8) | |
322 | 320 | let investmentProfitPartRaw = (profit - donationProfitPartRaw) | |
323 | 321 | let treasuryVolumeDiffAllocationCoefAbs = abs(treasuryVolumeDiffAllocationCoef) | |
324 | 322 | let amountToDonation = fraction(investmentProfitPartRaw, if ((0 > treasuryVolumeDiffAllocationCoef)) | |
325 | 323 | then treasuryVolumeDiffAllocationCoefAbs | |
326 | 324 | else 0, SCALE8) | |
327 | 325 | let amountToInvestment = fraction(donationProfitPartRaw, if ((treasuryVolumeDiffAllocationCoef > 0)) | |
328 | 326 | then treasuryVolumeDiffAllocationCoefAbs | |
329 | 327 | else 0, SCALE8) | |
330 | 328 | let donationProfitPart = ((donationProfitPartRaw - amountToInvestment) + amountToDonation) | |
331 | 329 | let investmentProfitPart = ((investmentProfitPartRaw - amountToDonation) + amountToInvestment) | |
332 | 330 | let donatedWavesAmountNewRaw = (donatedWavesAmount + donationProfitPart) | |
333 | 331 | let investedWavesAmountNewRaw = (investedWavesAmount + investmentProfitPart) | |
334 | 332 | let donatedPartDebt = min([0, donatedWavesAmountNewRaw]) | |
335 | 333 | let investedPartDebt = min([0, investedWavesAmountNewRaw]) | |
336 | 334 | let donatedWavesAmountNew = (max([0, donatedWavesAmountNewRaw]) + investedPartDebt) | |
337 | 335 | let investedWavesAmountNew = (max([0, investedWavesAmountNewRaw]) + donatedPartDebt) | |
338 | 336 | let newPeriod = (currentPeriodOrFail + 1) | |
339 | 337 | let lpAssetQuantity = valueOrErrorMessage(assetInfo(lpAssetIdOrFail), wrapErr("invalid lpAsset info")).quantity | |
340 | 338 | let newPrice = fraction(investedWavesAmountNew, SCALE8, lpAssetQuantity) | |
341 | 339 | let checkIfPriceNotZero = if ((newPrice != 0)) | |
342 | 340 | then true | |
343 | 341 | else throwErr("LP price cannot be 0") | |
344 | 342 | if ((checkIfPriceNotZero == checkIfPriceNotZero)) | |
345 | 343 | then { | |
346 | 344 | let lpAssetAmountToBurn = valueOrElse(getInteger(factoryAddressOrFail, keyWithdrawal()), 0) | |
347 | 345 | let paymentAmountMin = max([0, fraction(lpAssetAmountToBurn, newPrice, SCALE8)]) | |
348 | 346 | let paymentOption = if ((size(i.payments) > 0)) | |
349 | 347 | then i.payments[0] | |
350 | 348 | else unit | |
351 | 349 | let paymentAmount = value(paymentOption).amount | |
352 | 350 | let paymentAssetId = value(paymentOption).assetId | |
353 | 351 | let checkPayment = if (if ((paymentAmountMin == 0)) | |
354 | 352 | then true | |
355 | 353 | else if (if ((paymentOption != unit)) | |
356 | 354 | then (paymentAssetId == unit) | |
357 | 355 | else false) | |
358 | 356 | then (paymentAmount >= paymentAmountMin) | |
359 | 357 | else false) | |
360 | 358 | then true | |
361 | 359 | else throwErr(("invalid payments, payment amount min: " + toString(paymentAmountMin))) | |
362 | 360 | if ((checkPayment == checkPayment)) | |
363 | 361 | then { | |
364 | 362 | let actions = if ((paymentOption != unit)) | |
365 | 363 | then [ScriptTransfer(factoryAddressOrFail, paymentAmount, paymentAssetId)] | |
366 | 364 | else nil | |
367 | 365 | 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 | 366 | $Tuple2(actions, factoryActions) | |
369 | 367 | } | |
370 | 368 | else throw("Strict value is not equal to itself.") | |
371 | 369 | } | |
372 | 370 | else throw("Strict value is not equal to itself.") | |
373 | 371 | } | |
374 | 372 | else throw("Strict value is not equal to itself.") | |
375 | 373 | } | |
376 | 374 | else throw("Strict value is not equal to itself.") | |
377 | 375 | } | |
378 | 376 | ||
379 | 377 |
github/deemru/w8io/026f985 171.96 ms ◑