tx · EPhnEh5ESrNcd9FA9kXrhygkPQ2xZc6ba2UQfXb1CKwT 3N4mv2c2ehFvfSR5pXDCUqFZDaatagfBaMA: -0.03700000 Waves 2022.06.13 23:06 [2095050] smart account 3N4mv2c2ehFvfSR5pXDCUqFZDaatagfBaMA > SELF 0.00000000 Waves
{ "type": 13, "id": "EPhnEh5ESrNcd9FA9kXrhygkPQ2xZc6ba2UQfXb1CKwT", "fee": 3700000, "feeAssetId": null, "timestamp": 1655150808917, "version": 2, "chainId": 84, "sender": "3N4mv2c2ehFvfSR5pXDCUqFZDaatagfBaMA", "senderPublicKey": "DVEaMSvh9RbcfQEjtuj688gRa2kN2ATfwfT1VtWMewT1", "proofs": [ "3wmaQ4SA1PhVev7Lp2peqtZNP8voHRGM8bjWi6S5MarEzGrB1W7DLc4kMYhB2RbEFrG5cPnnGfnqHMijLvjKGiB1" ], "script": "base64:AAIFAAAAAAAAADgIAhILCgkBAQEBAQEBCAgSBgoEAQEBARIFCgMBAQESABIDCgEBEgASAwoBCBIAEgMKAQgSAwoBCAAAAE4AAAAACWtfb3JhX2tleQIAAAAJa19vcmFfa2V5AAAAAAVrX29yYQIAAAAFa19vcmEAAAAACWtfYmFsYW5jZQIAAAAJa19iYWxhbmNlAAAAAA5rX3Bvc2l0aW9uU2l6ZQIAAAAOa19wb3NpdGlvblNpemUAAAAAEGtfcG9zaXRpb25NYXJnaW4CAAAAEGtfcG9zaXRpb25NYXJnaW4AAAAABWtfcG9uAgAAABZrX3Bvc2l0aW9uT3Blbk5vdGlvbmFsAAAAABNrX3Bvc2l0aW9uTHN0VXBkQ1BGAgAAABJrX3Bvc2l0aW9uRnJhY3Rpb24AAAAADWtfaW5pdGlhbGl6ZWQCAAAADWtfaW5pdGlhbGl6ZWQAAAAABWtfZmVlAgAAAAVrX2ZlZQAAAAAPa19mdW5kaW5nUGVyaW9kAgAAAA9rX2Z1bmRpbmdQZXJpb2QAAAAAEWtfaW5pdE1hcmdpblJhdGlvAgAAABFrX2lua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Mjg2NzIAAAACXzQJAAACAAAAAQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkBAAAAAXMAAAABBQAAAAJ4MgkBAAAAAXMAAAABBQAAAAJ4MwkBAAAAAXMAAAABBQAAAAJ4NAkBAAAAAXMAAAABCQEAAAAOZ2V0TWFyZ2luUmF0aW8AAAABBQAAAAdfdHJhZGVyAAAAAWkBAAAABnZfZ2V0MgAAAAEAAAAHX3RyYWRlcgQAAAANJHQwMjg3ODUyODgzOAkBAAAAFWludGVybmFsQ2xvc2VQb3NpdGlvbgAAAAEFAAAAB190cmFkZXIEAAAAAngxCAUAAAANJHQwMjg3ODUyODgzOAAAAAJfMQQAAAACeDIIBQAAAA0kdDAyODc4NTI4ODM4AAAAAl8yBAAAAAJ4MwgFAAAADSR0MDI4Nzg1Mjg4MzgAAAACXzMEAAAAAng0CAUAAAANJHQwMjg3ODUyODgzOAAAAAJfNAkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQEAAAABcwAAAAEFAAAAAngyCQEAAAABcwAAAAEFAAAAAngzCQEAAAABcwAAAAEFAAAAAng0CQEAAAABcwAAAAEJAQAAAA5nZXRNYXJnaW5SYXRpbwAAAAEFAAAAB190cmFkZXIAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAQQURNSU5fUFVCTElDX0tFWXZ6hfc=", "height": 2095050, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8eRaEHemhAtsv2aUgTwXbzsuJzRy44o9J8zCGHRFEcGe Next: none Diff:
Old | New | Differences | |
---|---|---|---|
162 | 162 | } | |
163 | 163 | ||
164 | 164 | ||
165 | - | func requireOpenPosition (_trader) = { | |
166 | - | let $t039534064 = getPosition(_trader) | |
167 | - | let positionSize = $t039534064._1 | |
168 | - | let positionMargin = $t039534064._2 | |
169 | - | let pon = $t039534064._3 | |
170 | - | let positionLstUpdCPF = $t039534064._4 | |
171 | - | if ((positionSize == 0)) | |
172 | - | then throw("No open position") | |
173 | - | else true | |
174 | - | } | |
165 | + | func requireOpenPosition (_trader) = if ((getPosition(_trader)._1 == 0)) | |
166 | + | then throw("No open position") | |
167 | + | else true | |
175 | 168 | ||
176 | 169 | ||
177 | 170 | func initialized () = valueOrElse(getBoolean(this, k_initialized), false) | |
178 | 171 | ||
179 | 172 | ||
180 | 173 | func updateReserve (_isAdd,_quoteAssetAmount,_baseAssetAmount) = if (_isAdd) | |
181 | - | then $Tuple5((qtAstR() + _quoteAssetAmount), (bsAstR() - _baseAssetAmount), (baseAsstFndDelt() - _baseAssetAmount), (totalPositionSize() + _baseAssetAmount), (cumulativeNotional() + _quoteAssetAmount)) | |
182 | - | else $Tuple5((qtAstR() - _quoteAssetAmount), (bsAstR() + _baseAssetAmount), (baseAsstFndDelt() + _baseAssetAmount), (totalPositionSize() - _baseAssetAmount), (cumulativeNotional() - _quoteAssetAmount)) | |
174 | + | then { | |
175 | + | let newBase = (bsAstR() - _baseAssetAmount) | |
176 | + | if ((0 >= newBase)) | |
177 | + | then throw("Tx lead to base asset reserver <= 0, revert") | |
178 | + | else $Tuple5((qtAstR() + _quoteAssetAmount), newBase, (baseAsstFndDelt() - _baseAssetAmount), (totalPositionSize() + _baseAssetAmount), (cumulativeNotional() + _quoteAssetAmount)) | |
179 | + | } | |
180 | + | else { | |
181 | + | let newQuote = (qtAstR() - _quoteAssetAmount) | |
182 | + | if ((0 >= newQuote)) | |
183 | + | then throw("Tx lead to base quote reserver <= 0, revert") | |
184 | + | else $Tuple5(newQuote, (bsAstR() + _baseAssetAmount), (baseAsstFndDelt() + _baseAssetAmount), (totalPositionSize() - _baseAssetAmount), (cumulativeNotional() - _quoteAssetAmount)) | |
185 | + | } | |
183 | 186 | ||
184 | 187 | ||
185 | 188 | func swapInput (_isAdd,_quoteAssetAmoun) = { | |
194 | 197 | let amountBaseAssetBought = if (_isAdd) | |
195 | 198 | then amountBaseAssetBoughtAbs | |
196 | 199 | else -(amountBaseAssetBoughtAbs) | |
197 | - | let $ | |
198 | - | let qtAstRAfter1 = $ | |
199 | - | let bsAstRAfter1 = $ | |
200 | - | let baseAsstFndDeltAfter1 = $ | |
201 | - | let totalPositionSizeAfter1 = $ | |
202 | - | let cumulativeNotionalAfter1 = $ | |
200 | + | let $t055655763 = updateReserve(_isAdd, _quoteAssetAmoun, amountBaseAssetBoughtAbs) | |
201 | + | let qtAstRAfter1 = $t055655763._1 | |
202 | + | let bsAstRAfter1 = $t055655763._2 | |
203 | + | let baseAsstFndDeltAfter1 = $t055655763._3 | |
204 | + | let totalPositionSizeAfter1 = $t055655763._4 | |
205 | + | let cumulativeNotionalAfter1 = $t055655763._5 | |
203 | 206 | $Tuple6(amountBaseAssetBought, qtAstRAfter1, bsAstRAfter1, baseAsstFndDeltAfter1, totalPositionSizeAfter1, cumulativeNotionalAfter1) | |
204 | 207 | } | |
205 | 208 | ||
210 | 213 | then muld((_latestCPF - _oldPositionLstUpdCPF), _oldPositionSize) | |
211 | 214 | else 0 | |
212 | 215 | let signedMargin = ((_marginDelta - fundingPayment) + _oldPositionMargin) | |
213 | - | let $ | |
216 | + | let $t063376464 = if ((0 > signedMargin)) | |
214 | 217 | then $Tuple2(0, abs(signedMargin)) | |
215 | 218 | else $Tuple2(abs(signedMargin), 0) | |
216 | - | let remainMargin = $ | |
217 | - | let badDebt = $ | |
219 | + | let remainMargin = $t063376464._1 | |
220 | + | let badDebt = $t063376464._2 | |
218 | 221 | $Tuple4(remainMargin, badDebt, fundingPayment, _latestCPF) | |
219 | 222 | } | |
220 | 223 | ||
228 | 231 | else (_baseAssetPoolAmount - _baseAssetAmount) | |
229 | 232 | let quoteAssetAfter = divd(k, baseAssetPoolAmountAfter) | |
230 | 233 | let quoteAssetSold = abs((quoteAssetAfter - _quoteAssetPoolAmount)) | |
231 | - | let $ | |
232 | - | let qtAstRAfter1 = $ | |
233 | - | let bsAstRAfter1 = $ | |
234 | - | let baseAsstFndDeltAfter1 = $ | |
235 | - | let totalPositionSizeAfter1 = $ | |
236 | - | let cumulativeNotionalAfter1 = $ | |
234 | + | let $t071137312 = updateReserve(!(_add), quoteAssetSold, _baseAssetAmount) | |
235 | + | let qtAstRAfter1 = $t071137312._1 | |
236 | + | let bsAstRAfter1 = $t071137312._2 | |
237 | + | let baseAsstFndDeltAfter1 = $t071137312._3 | |
238 | + | let totalPositionSizeAfter1 = $t071137312._4 | |
239 | + | let cumulativeNotionalAfter1 = $t071137312._5 | |
237 | 240 | $Tuple6(quoteAssetSold, qtAstRAfter1, bsAstRAfter1, baseAsstFndDeltAfter1, totalPositionSizeAfter1, cumulativeNotionalAfter1) | |
238 | 241 | } | |
239 | 242 | ||
240 | 243 | ||
241 | 244 | func getPositionNotionalAndUnrealizedPnl (_trader) = { | |
242 | - | let $ | |
243 | - | let positionSize = $ | |
244 | - | let positionMargin = $ | |
245 | - | let pon = $ | |
246 | - | let positionLstUpdCPF = $ | |
245 | + | let $t075507661 = getPosition(_trader) | |
246 | + | let positionSize = $t075507661._1 | |
247 | + | let positionMargin = $t075507661._2 | |
248 | + | let pon = $t075507661._3 | |
249 | + | let positionLstUpdCPF = $t075507661._4 | |
247 | 250 | let positionSizeAbs = abs(positionSize) | |
248 | 251 | if ((positionSizeAbs == 0)) | |
249 | 252 | then throw("Invalid position size") | |
250 | 253 | else { | |
251 | 254 | let isShort = (0 > positionSize) | |
252 | - | let $ | |
253 | - | let positionNotional = $ | |
254 | - | let x1 = $ | |
255 | - | let x2 = $ | |
256 | - | let x3 = $ | |
255 | + | let $t078387988 = getOutputPriceWithReserves(!(isShort), positionSizeAbs, qtAstR(), bsAstR()) | |
256 | + | let positionNotional = $t078387988._1 | |
257 | + | let x1 = $t078387988._2 | |
258 | + | let x2 = $t078387988._3 | |
259 | + | let x3 = $t078387988._4 | |
257 | 260 | let unrealizedPnl = if (isShort) | |
258 | 261 | then (pon - positionNotional) | |
259 | 262 | else (positionNotional - pon) | |
273 | 276 | ||
274 | 277 | ||
275 | 278 | func getMarginRatio (_trader) = { | |
276 | - | let $ | |
277 | - | let positionSize = $ | |
278 | - | let positionMargin = $ | |
279 | - | let pon = $ | |
280 | - | let positionLstUpdCPF = $ | |
281 | - | let $ | |
282 | - | let positionNotional = $ | |
283 | - | let unrealizedPnl = $ | |
284 | - | let $ | |
285 | - | let remainMargin = $ | |
286 | - | let badDebt = $ | |
279 | + | let $t084988609 = getPosition(_trader) | |
280 | + | let positionSize = $t084988609._1 | |
281 | + | let positionMargin = $t084988609._2 | |
282 | + | let pon = $t084988609._3 | |
283 | + | let positionLstUpdCPF = $t084988609._4 | |
284 | + | let $t086158699 = getPositionNotionalAndUnrealizedPnl(_trader) | |
285 | + | let positionNotional = $t086158699._1 | |
286 | + | let unrealizedPnl = $t086158699._2 | |
287 | + | let $t087048870 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
288 | + | let remainMargin = $t087048870._1 | |
289 | + | let badDebt = $t087048870._2 | |
287 | 290 | divd((remainMargin - badDebt), positionNotional) | |
288 | 291 | } | |
289 | 292 | ||
290 | 293 | ||
291 | 294 | func internalClosePosition (_trader) = { | |
292 | - | let $ | |
293 | - | let positionSize = $ | |
294 | - | let positionMargin = $ | |
295 | - | let pon = $ | |
296 | - | let positionLstUpdCPF = $ | |
297 | - | let $ | |
298 | - | let x1 = $ | |
299 | - | let unrealizedPnl = $ | |
300 | - | let $ | |
301 | - | let remainMargin = $ | |
302 | - | let badDebt = $ | |
303 | - | let x2 = $ | |
295 | + | let $t089779088 = getPosition(_trader) | |
296 | + | let positionSize = $t089779088._1 | |
297 | + | let positionMargin = $t089779088._2 | |
298 | + | let pon = $t089779088._3 | |
299 | + | let positionLstUpdCPF = $t089779088._4 | |
300 | + | let $t090949164 = getPositionNotionalAndUnrealizedPnl(_trader) | |
301 | + | let x1 = $t090949164._1 | |
302 | + | let unrealizedPnl = $t090949164._2 | |
303 | + | let $t091699341 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
304 | + | let remainMargin = $t091699341._1 | |
305 | + | let badDebt = $t091699341._2 | |
306 | + | let x2 = $t091699341._3 | |
304 | 307 | let exchangedPositionSize = -(positionSize) | |
305 | 308 | let realizedPnl = unrealizedPnl | |
306 | 309 | let marginToVault = -(remainMargin) | |
307 | - | let $ | |
308 | - | let exchangedQuoteAssetAmount = $ | |
309 | - | let quoteAssetReserveAfter = $ | |
310 | - | let bsAstRAfter = $ | |
311 | - | let baseAsstFndDeltAfter = $ | |
312 | - | let totalPositionSizeAfter = $ | |
313 | - | let cumulativeNotionalAfter = $ | |
310 | + | let $t094689775 = getOutputPriceWithReserves((positionSize > 0), abs(positionSize), qtAstR(), bsAstR()) | |
311 | + | let exchangedQuoteAssetAmount = $t094689775._1 | |
312 | + | let quoteAssetReserveAfter = $t094689775._2 | |
313 | + | let bsAstRAfter = $t094689775._3 | |
314 | + | let baseAsstFndDeltAfter = $t094689775._4 | |
315 | + | let totalPositionSizeAfter = $t094689775._5 | |
316 | + | let cumulativeNotionalAfter = $t094689775._6 | |
314 | 317 | let openInteresetNotionalAfter = (openInteresetNotional() - pon) | |
315 | 318 | $Tuple11(exchangedPositionSize, badDebt, realizedPnl, marginToVault, quoteAssetReserveAfter, bsAstRAfter, baseAsstFndDeltAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInteresetNotionalAfter, exchangedQuoteAssetAmount) | |
316 | 319 | } | |
387 | 390 | else !(requireMoreMarginRatio(divd(DECIMAL_UNIT, _leverage), initMarginRatio(), true))) | |
388 | 391 | then throw("Invalid decreasePosition parameters") | |
389 | 392 | else { | |
390 | - | let $ | |
391 | - | let oldPositionSize = $ | |
392 | - | let oldPositionMargin = $ | |
393 | - | let oldPositionOpenNotional = $ | |
394 | - | let oldPositionLstUpdCPF = $ | |
393 | + | let $t01416814320 = getPosition(toString(i.caller)) | |
394 | + | let oldPositionSize = $t01416814320._1 | |
395 | + | let oldPositionMargin = $t01416814320._2 | |
396 | + | let oldPositionOpenNotional = $t01416814320._3 | |
397 | + | let oldPositionLstUpdCPF = $t01416814320._4 | |
395 | 398 | let isNewPosition = (oldPositionSize == 0) | |
396 | 399 | let isSameDirection = if ((oldPositionSize > 0)) | |
397 | 400 | then (_direction == DIR_LONG) | |
400 | 403 | then isSameDirection | |
401 | 404 | else false | |
402 | 405 | let isAdd = (_direction == DIR_LONG) | |
403 | - | let $ | |
406 | + | let $t01460917342 = if (if (isNewPosition) | |
404 | 407 | then true | |
405 | 408 | else expandExisting) | |
406 | 409 | then throw("Use increasePosition to open new or increase position") | |
407 | 410 | else { | |
408 | 411 | let openNotional = muld(_amount, _leverage) | |
409 | - | let $ | |
410 | - | let oldPositionNotional = $ | |
411 | - | let unrealizedPnl = $ | |
412 | + | let $t01507715176 = getPositionNotionalAndUnrealizedPnl(toString(i.caller)) | |
413 | + | let oldPositionNotional = $t01507715176._1 | |
414 | + | let unrealizedPnl = $t01507715176._2 | |
412 | 415 | if ((oldPositionNotional > openNotional)) | |
413 | 416 | then { | |
414 | - | let $ | |
415 | - | let exchangedPositionSize = $ | |
416 | - | let qtAstRAfter = $ | |
417 | - | let bsAstRAfter = $ | |
418 | - | let baseAsstFndDeltAfter = $ | |
419 | - | let totalPositionSizeAfter = $ | |
420 | - | let cumulativeNotionalAfter = $ | |
417 | + | let $t01523815481 = swapInput(isAdd, openNotional) | |
418 | + | let exchangedPositionSize = $t01523815481._1 | |
419 | + | let qtAstRAfter = $t01523815481._2 | |
420 | + | let bsAstRAfter = $t01523815481._3 | |
421 | + | let baseAsstFndDeltAfter = $t01523815481._4 | |
422 | + | let totalPositionSizeAfter = $t01523815481._5 | |
423 | + | let cumulativeNotionalAfter = $t01523815481._6 | |
421 | 424 | let exchangedPositionSizeAbs = abs(exchangedPositionSize) | |
422 | 425 | if (if ((_minBaseAssetAmount != 0)) | |
423 | 426 | then (_minBaseAssetAmount > exchangedPositionSizeAbs) | |
427 | 430 | let realizedPnl = if ((oldPositionSize != 0)) | |
428 | 431 | then divd(muld(unrealizedPnl, exchangedPositionSizeAbs), oldPositionSize) | |
429 | 432 | else 0 | |
430 | - | let $ | |
431 | - | let remainMargin = $ | |
432 | - | let badDebt = $ | |
433 | - | let fundingPayment = $ | |
434 | - | let oldLatestCPF = $ | |
433 | + | let $t01602216293 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl) | |
434 | + | let remainMargin = $t01602216293._1 | |
435 | + | let badDebt = $t01602216293._2 | |
436 | + | let fundingPayment = $t01602216293._3 | |
437 | + | let oldLatestCPF = $t01602216293._4 | |
435 | 438 | let exchangedQuoteAssetAmount = openNotional | |
436 | 439 | let unrealizedPnlAfter = (unrealizedPnl - realizedPnl) | |
437 | 440 | let remainOpenNotional = if ((oldPositionSize > 0)) | |
442 | 445 | } | |
443 | 446 | else throw("Close position first") | |
444 | 447 | } | |
445 | - | let newPositionSize = $ | |
446 | - | let newPositionRemainMargin = $ | |
447 | - | let newPosiionOpenNotional = $ | |
448 | - | let newPositionLatestCPF = $ | |
449 | - | let bsAstRAfter = $ | |
450 | - | let qtAstRAfter = $ | |
451 | - | let baseAsstFndDeltAfter = $ | |
452 | - | let totalPositionSizeAfter = $ | |
453 | - | let cumulativeNotionalAfter = $ | |
454 | - | let openInteresetNotionalAfter = $ | |
448 | + | let newPositionSize = $t01460917342._1 | |
449 | + | let newPositionRemainMargin = $t01460917342._2 | |
450 | + | let newPosiionOpenNotional = $t01460917342._3 | |
451 | + | let newPositionLatestCPF = $t01460917342._4 | |
452 | + | let bsAstRAfter = $t01460917342._5 | |
453 | + | let qtAstRAfter = $t01460917342._6 | |
454 | + | let baseAsstFndDeltAfter = $t01460917342._7 | |
455 | + | let totalPositionSizeAfter = $t01460917342._8 | |
456 | + | let cumulativeNotionalAfter = $t01460917342._9 | |
457 | + | let openInteresetNotionalAfter = $t01460917342._10 | |
455 | 458 | (updatePosition(toString(i.caller), newPositionSize, newPositionRemainMargin, newPosiionOpenNotional, newPositionLatestCPF) ++ updateAmm(qtAstRAfter, bsAstRAfter, baseAsstFndDeltAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInteresetNotionalAfter)) | |
456 | 459 | } | |
457 | 460 | ||
479 | 482 | else { | |
480 | 483 | let feeAmount = muld(_rawAmount, fee()) | |
481 | 484 | let _amount = (_rawAmount - feeAmount) | |
482 | - | let $ | |
483 | - | let oldPositionSize = $ | |
484 | - | let oldPositionMargin = $ | |
485 | - | let oldPositionOpenNotional = $ | |
486 | - | let oldPositionLstUpdCPF = $ | |
485 | + | let $t01831618468 = getPosition(toString(i.caller)) | |
486 | + | let oldPositionSize = $t01831618468._1 | |
487 | + | let oldPositionMargin = $t01831618468._2 | |
488 | + | let oldPositionOpenNotional = $t01831618468._3 | |
489 | + | let oldPositionLstUpdCPF = $t01831618468._4 | |
487 | 490 | let isNewPosition = (oldPositionSize == 0) | |
488 | 491 | let isSameDirection = if ((oldPositionSize > 0)) | |
489 | 492 | then (_direction == DIR_LONG) | |
492 | 495 | then isSameDirection | |
493 | 496 | else false | |
494 | 497 | let isAdd = (_direction == DIR_LONG) | |
495 | - | let $ | |
498 | + | let $t01875720881 = if (if (isNewPosition) | |
496 | 499 | then true | |
497 | 500 | else expandExisting) | |
498 | 501 | then { | |
499 | 502 | let openNotional = muld(_amount, _leverage) | |
500 | - | let $ | |
501 | - | let amountBaseAssetBought = $ | |
502 | - | let qtAstRAfter = $ | |
503 | - | let bsAstRAfter = $ | |
504 | - | let baseAsstFndDeltAfter = $ | |
505 | - | let totalPositionSizeAfter = $ | |
506 | - | let cumulativeNotionalAfter = $ | |
503 | + | let $t01914319358 = swapInput(isAdd, openNotional) | |
504 | + | let amountBaseAssetBought = $t01914319358._1 | |
505 | + | let qtAstRAfter = $t01914319358._2 | |
506 | + | let bsAstRAfter = $t01914319358._3 | |
507 | + | let baseAsstFndDeltAfter = $t01914319358._4 | |
508 | + | let totalPositionSizeAfter = $t01914319358._5 | |
509 | + | let cumulativeNotionalAfter = $t01914319358._6 | |
507 | 510 | if (if ((_minBaseAssetAmount != 0)) | |
508 | 511 | then (_minBaseAssetAmount > abs(amountBaseAssetBought)) | |
509 | 512 | else false) | |
511 | 514 | else { | |
512 | 515 | let newPositionSize = (oldPositionSize + amountBaseAssetBought) | |
513 | 516 | let increaseMarginRequirement = divd(openNotional, _leverage) | |
514 | - | let $ | |
515 | - | let remainMargin = $ | |
516 | - | let x1 = $ | |
517 | - | let x2 = $ | |
518 | - | let oldLatestCPF = $ | |
517 | + | let $t01973919992 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, increaseMarginRequirement) | |
518 | + | let remainMargin = $t01973919992._1 | |
519 | + | let x1 = $t01973919992._2 | |
520 | + | let x2 = $t01973919992._3 | |
521 | + | let oldLatestCPF = $t01973919992._4 | |
519 | 522 | $Tuple10(newPositionSize, remainMargin, (oldPositionOpenNotional + openNotional), oldLatestCPF, bsAstRAfter, qtAstRAfter, baseAsstFndDeltAfter, totalPositionSizeAfter, cumulativeNotionalAfter, (openInteresetNotional() + openNotional)) | |
520 | 523 | } | |
521 | 524 | } | |
522 | 525 | else { | |
523 | 526 | let openNotional = muld(_amount, _leverage) | |
524 | - | let $ | |
525 | - | let oldPositionNotional = $ | |
526 | - | let unrealizedPnl = $ | |
527 | + | let $t02059120690 = getPositionNotionalAndUnrealizedPnl(toString(i.caller)) | |
528 | + | let oldPositionNotional = $t02059120690._1 | |
529 | + | let unrealizedPnl = $t02059120690._2 | |
527 | 530 | if ((oldPositionNotional > openNotional)) | |
528 | 531 | then throw("Use decreasePosition to decrease position size") | |
529 | 532 | else throw("Close position first") | |
530 | 533 | } | |
531 | - | let newPositionSize = $ | |
532 | - | let newPositionRemainMargin = $ | |
533 | - | let newPosiionOpenNotional = $ | |
534 | - | let newPositionLatestCPF = $ | |
535 | - | let bsAstRAfter = $ | |
536 | - | let qtAstRAfter = $ | |
537 | - | let baseAsstFndDeltAfter = $ | |
538 | - | let totalPositionSizeAfter = $ | |
539 | - | let cumulativeNotionalAfter = $ | |
540 | - | let openInteresetNotionalAfter = $ | |
534 | + | let newPositionSize = $t01875720881._1 | |
535 | + | let newPositionRemainMargin = $t01875720881._2 | |
536 | + | let newPosiionOpenNotional = $t01875720881._3 | |
537 | + | let newPositionLatestCPF = $t01875720881._4 | |
538 | + | let bsAstRAfter = $t01875720881._5 | |
539 | + | let qtAstRAfter = $t01875720881._6 | |
540 | + | let baseAsstFndDeltAfter = $t01875720881._7 | |
541 | + | let totalPositionSizeAfter = $t01875720881._8 | |
542 | + | let cumulativeNotionalAfter = $t01875720881._9 | |
543 | + | let openInteresetNotionalAfter = $t01875720881._10 | |
541 | 544 | let stake = invoke(USDN_STAKING, "lockNeutrino", nil, [AttachedPayment(USDN, _amount)]) | |
542 | 545 | if ((stake == stake)) | |
543 | 546 | then (((updatePosition(toString(i.caller), newPositionSize, newPositionRemainMargin, newPosiionOpenNotional, newPositionLatestCPF) ++ updateAmm(qtAstRAfter, bsAstRAfter, baseAsstFndDeltAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInteresetNotionalAfter)) ++ transferFee(feeAmount)) ++ upblc((cbalance() + _amount))) | |
557 | 560 | else { | |
558 | 561 | let feeAmount = muld(_rawAmount, fee()) | |
559 | 562 | let _amount = (_rawAmount - feeAmount) | |
560 | - | let $ | |
561 | - | let oldPositionSize = $ | |
562 | - | let oldPositionMargin = $ | |
563 | - | let oldPositionOpenNotional = $ | |
564 | - | let oldPositionLstUpdCPF = $ | |
563 | + | let $t02176721919 = getPosition(toString(i.caller)) | |
564 | + | let oldPositionSize = $t02176721919._1 | |
565 | + | let oldPositionMargin = $t02176721919._2 | |
566 | + | let oldPositionOpenNotional = $t02176721919._3 | |
567 | + | let oldPositionLstUpdCPF = $t02176721919._4 | |
565 | 568 | let stake = invoke(USDN_STAKING, "lockNeutrino", nil, [AttachedPayment(USDN, _amount)]) | |
566 | 569 | if ((stake == stake)) | |
567 | 570 | then ((updatePosition(toString(i.caller), oldPositionSize, (oldPositionMargin + i.payments[0].amount), oldPositionOpenNotional, oldPositionLstUpdCPF) ++ transferFee(feeAmount)) ++ upblc((cbalance() + _amount))) | |
577 | 580 | else !(requireOpenPosition(toString(i.caller)))) | |
578 | 581 | then throw("Invalid removeMargin parameters") | |
579 | 582 | else { | |
580 | - | let $ | |
581 | - | let oldPositionSize = $ | |
582 | - | let oldPositionMargin = $ | |
583 | - | let oldPositionOpenNotional = $ | |
584 | - | let oldPositionLstUpdCPF = $ | |
583 | + | let $t02250522657 = getPosition(toString(i.caller)) | |
584 | + | let oldPositionSize = $t02250522657._1 | |
585 | + | let oldPositionMargin = $t02250522657._2 | |
586 | + | let oldPositionOpenNotional = $t02250522657._3 | |
587 | + | let oldPositionLstUpdCPF = $t02250522657._4 | |
585 | 588 | let marginDelta = -(_amount) | |
586 | - | let $ | |
587 | - | let remainMargin = $ | |
588 | - | let badDebt = $ | |
589 | - | let x1 = $ | |
590 | - | let latestCPF1 = $ | |
589 | + | let $t02269422889 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, marginDelta) | |
590 | + | let remainMargin = $t02269422889._1 | |
591 | + | let badDebt = $t02269422889._2 | |
592 | + | let x1 = $t02269422889._3 | |
593 | + | let latestCPF1 = $t02269422889._4 | |
591 | 594 | if ((badDebt != 0)) | |
592 | 595 | then throw("Invalid added margin amount") | |
593 | 596 | else { | |
604 | 607 | func closePosition () = if (!(requireOpenPosition(toString(i.caller)))) | |
605 | 608 | then throw("Invalid closePosition parameters") | |
606 | 609 | else { | |
607 | - | let $ | |
608 | - | let x1 = $ | |
609 | - | let badDebt = $ | |
610 | - | let realizedPnl = $ | |
611 | - | let marginToVault = $ | |
612 | - | let quoteAssetReserveAfter = $ | |
613 | - | let bsAstRAfter = $ | |
614 | - | let baseAsstFndDeltAfter = $ | |
615 | - | let totalPositionSizeAfter = $ | |
616 | - | let cumulativeNotionalAfter = $ | |
617 | - | let openInteresetNotionalAfter = $ | |
610 | + | let $t02353923871 = internalClosePosition(toString(i.caller)) | |
611 | + | let x1 = $t02353923871._1 | |
612 | + | let badDebt = $t02353923871._2 | |
613 | + | let realizedPnl = $t02353923871._3 | |
614 | + | let marginToVault = $t02353923871._4 | |
615 | + | let quoteAssetReserveAfter = $t02353923871._5 | |
616 | + | let bsAstRAfter = $t02353923871._6 | |
617 | + | let baseAsstFndDeltAfter = $t02353923871._7 | |
618 | + | let totalPositionSizeAfter = $t02353923871._8 | |
619 | + | let cumulativeNotionalAfter = $t02353923871._9 | |
620 | + | let openInteresetNotionalAfter = $t02353923871._10 | |
618 | 621 | if ((badDebt > 0)) | |
619 | 622 | then throw("Unable to close position with bad debt") | |
620 | 623 | else { | |
621 | 624 | let withdrawAmount = abs(marginToVault) | |
622 | 625 | let bd = (cbalance() - withdrawAmount) | |
623 | - | let $ | |
626 | + | let $t02406424160 = if ((0 > bd)) | |
624 | 627 | then $Tuple2(0, abs(bd)) | |
625 | 628 | else $Tuple2(bd, 0) | |
626 | - | let nb = $ | |
627 | - | let fromi = $ | |
629 | + | let nb = $t02406424160._1 | |
630 | + | let fromi = $t02406424160._2 | |
628 | 631 | let x = if ((fromi > 0)) | |
629 | 632 | then { | |
630 | 633 | let withdrawInsurance = invoke(INSURANCE_ADDRESS, "withdraw", [fromi], nil) | |
652 | 655 | else !(initialized())) | |
653 | 656 | then throw("Unable to liquidate") | |
654 | 657 | else { | |
655 | - | let $ | |
656 | - | let x1 = $ | |
657 | - | let badDebt = $ | |
658 | - | let x2 = $ | |
659 | - | let marginToVault = $ | |
660 | - | let quoteAssetReserveAfter = $ | |
661 | - | let bsAstRAfter = $ | |
662 | - | let baseAsstFndDeltAfter = $ | |
663 | - | let totalPositionSizeAfter = $ | |
664 | - | let cumulativeNotionalAfter = $ | |
665 | - | let openInteresetNotionalAfter = $ | |
666 | - | let exchangedQuoteAssetAmount = $ | |
658 | + | let $t02509825402 = internalClosePosition(_trader) | |
659 | + | let x1 = $t02509825402._1 | |
660 | + | let badDebt = $t02509825402._2 | |
661 | + | let x2 = $t02509825402._3 | |
662 | + | let marginToVault = $t02509825402._4 | |
663 | + | let quoteAssetReserveAfter = $t02509825402._5 | |
664 | + | let bsAstRAfter = $t02509825402._6 | |
665 | + | let baseAsstFndDeltAfter = $t02509825402._7 | |
666 | + | let totalPositionSizeAfter = $t02509825402._8 | |
667 | + | let cumulativeNotionalAfter = $t02509825402._9 | |
668 | + | let openInteresetNotionalAfter = $t02509825402._10 | |
669 | + | let exchangedQuoteAssetAmount = $t02509825402._11 | |
667 | 670 | let feeToLiquidator = (muld(exchangedQuoteAssetAmount, liquidationFeeRatio()) / 2) | |
668 | - | let $ | |
671 | + | let $t02549225896 = if ((feeToLiquidator > marginToVault)) | |
669 | 672 | then $Tuple3((feeToLiquidator - marginToVault), marginToVault, ((badDebt + feeToLiquidator) - marginToVault)) | |
670 | 673 | else $Tuple3(0, (marginToVault - feeToLiquidator), badDebt) | |
671 | - | let liquidationBadDebt = $ | |
672 | - | let remainMargin = $ | |
673 | - | let totalBadDebt = $ | |
674 | + | let liquidationBadDebt = $t02549225896._1 | |
675 | + | let remainMargin = $t02549225896._2 | |
676 | + | let totalBadDebt = $t02549225896._3 | |
674 | 677 | let bd = (cbalance() - feeToLiquidator) | |
675 | - | let $ | |
678 | + | let $t02594426032 = if ((0 > bd)) | |
676 | 679 | then $Tuple2(0, abs(bd)) | |
677 | 680 | else $Tuple2(bd, 0) | |
678 | - | let nb = $ | |
679 | - | let fromi = $ | |
681 | + | let nb = $t02594426032._1 | |
682 | + | let fromi = $t02594426032._2 | |
680 | 683 | let x = if ((fromi > 0)) | |
681 | 684 | then { | |
682 | 685 | let withdrawInsurance = invoke(INSURANCE_ADDRESS, "withdraw", [fromi], nil) | |
712 | 715 | let totalTraderPositionSize = totalPositionSize() | |
713 | 716 | let ammFundingPaymentProfit = muld(premiumFraction, totalTraderPositionSize) | |
714 | 717 | let fundingAmount = abs(ammFundingPaymentProfit) | |
715 | - | if ((0 > ammFundingPaymentProfit)) | |
718 | + | let balanceChange = if ((0 > ammFundingPaymentProfit)) | |
716 | 719 | then { | |
717 | 720 | let withdrawInsurance = invoke(INSURANCE_ADDRESS, "withdraw", [fundingAmount], nil) | |
718 | 721 | if ((withdrawInsurance == withdrawInsurance)) | |
724 | 727 | } | |
725 | 728 | else throw("Strict value is not equal to itself.") | |
726 | 729 | } | |
727 | - | else ({ | |
728 | - | let unstake = invoke(USDN_STAKING, "unlockNeutrino", [fundingAmount, toBase58String(USDN)], nil) | |
729 | - | if ((unstake == unstake)) | |
730 | - | then { | |
731 | - | let depositInsurance = invoke(INSURANCE_ADDRESS, "deposit", nil, [AttachedPayment(USDN, fundingAmount)]) | |
732 | - | if ((depositInsurance == depositInsurance)) | |
733 | - | then upblc((cbalance() - fundingAmount)) | |
734 | - | else throw("Strict value is not equal to itself.") | |
735 | - | } | |
736 | - | else throw("Strict value is not equal to itself.") | |
737 | - | } ++ updateFunding(0, (fundingBlockTimestamp + fundingPeriodSeconds()), (latestCPF() + premiumFraction), divd(premiumFraction, underlyingPrice))) | |
730 | + | else if ((ammFundingPaymentProfit != 0)) | |
731 | + | then { | |
732 | + | let unstake = invoke(USDN_STAKING, "unlockNeutrino", [fundingAmount, toBase58String(USDN)], nil) | |
733 | + | if ((unstake == unstake)) | |
734 | + | then { | |
735 | + | let depositInsurance = invoke(INSURANCE_ADDRESS, "deposit", nil, [AttachedPayment(USDN, fundingAmount)]) | |
736 | + | if ((depositInsurance == depositInsurance)) | |
737 | + | then upblc((cbalance() - fundingAmount)) | |
738 | + | else throw("Strict value is not equal to itself.") | |
739 | + | } | |
740 | + | else throw("Strict value is not equal to itself.") | |
741 | + | } | |
742 | + | else upblc((cbalance() - fundingAmount)) | |
743 | + | (balanceChange ++ updateFunding(0, (fundingBlockTimestamp + fundingPeriodSeconds()), (latestCPF() + premiumFraction), divd(premiumFraction, underlyingPrice))) | |
738 | 744 | } | |
739 | 745 | } | |
740 | 746 | ||
741 | 747 | ||
742 | 748 | ||
743 | 749 | @Callable(i) | |
744 | - | func v_close (_trader) = { | |
745 | - | let $t02821428292 = internalClosePosition(_trader) | |
746 | - | let x1 = $t02821428292._1 | |
747 | - | let x2 = $t02821428292._2 | |
748 | - | let x3 = $t02821428292._3 | |
749 | - | let x4 = $t02821428292._4 | |
750 | - | let x5 = $t02821428292._5 | |
751 | - | let x6 = $t02821428292._6 | |
752 | - | let x7 = $t02821428292._7 | |
753 | - | let x8 = $t02821428292._8 | |
754 | - | let x9 = $t02821428292._9 | |
755 | - | let x10 = $t02821428292._10 | |
756 | - | throw(((s(x2) + s(x3)) + s(x4))) | |
750 | + | func v_get (_trader) = { | |
751 | + | let $t02861928672 = internalClosePosition(_trader) | |
752 | + | let x1 = $t02861928672._1 | |
753 | + | let x2 = $t02861928672._2 | |
754 | + | let x3 = $t02861928672._3 | |
755 | + | let x4 = $t02861928672._4 | |
756 | + | throw((((s(x2) + s(x3)) + s(x4)) + s(getMarginRatio(_trader)))) | |
757 | + | } | |
758 | + | ||
759 | + | ||
760 | + | ||
761 | + | @Callable(i) | |
762 | + | func v_get2 (_trader) = { | |
763 | + | let $t02878528838 = internalClosePosition(_trader) | |
764 | + | let x1 = $t02878528838._1 | |
765 | + | let x2 = $t02878528838._2 | |
766 | + | let x3 = $t02878528838._3 | |
767 | + | let x4 = $t02878528838._4 | |
768 | + | throw((((s(x2) + s(x3)) + s(x4)) + s(getMarginRatio(_trader)))) | |
757 | 769 | } | |
758 | 770 | ||
759 | 771 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let k_ora_key = "k_ora_key" | |
5 | 5 | ||
6 | 6 | let k_ora = "k_ora" | |
7 | 7 | ||
8 | 8 | let k_balance = "k_balance" | |
9 | 9 | ||
10 | 10 | let k_positionSize = "k_positionSize" | |
11 | 11 | ||
12 | 12 | let k_positionMargin = "k_positionMargin" | |
13 | 13 | ||
14 | 14 | let k_pon = "k_positionOpenNotional" | |
15 | 15 | ||
16 | 16 | let k_positionLstUpdCPF = "k_positionFraction" | |
17 | 17 | ||
18 | 18 | let k_initialized = "k_initialized" | |
19 | 19 | ||
20 | 20 | let k_fee = "k_fee" | |
21 | 21 | ||
22 | 22 | let k_fundingPeriod = "k_fundingPeriod" | |
23 | 23 | ||
24 | 24 | let k_initMarginRatio = "k_initMarginRatio" | |
25 | 25 | ||
26 | 26 | let k_mmr = "k_mmr" | |
27 | 27 | ||
28 | 28 | let k_liquidationFeeRatio = "k_liquidationFeeRatio" | |
29 | 29 | ||
30 | 30 | let k_latestCPF = "k_latestPremiumFraction" | |
31 | 31 | ||
32 | 32 | let k_nextFundingBlock = "k_nextFundingBlockMinTimestamp" | |
33 | 33 | ||
34 | 34 | let k_fundingRate = "k_fundingRate" | |
35 | 35 | ||
36 | 36 | let k_qtAstR = "k_qtAstR" | |
37 | 37 | ||
38 | 38 | let k_bsAstR = "k_bsAstR" | |
39 | 39 | ||
40 | 40 | let k_baseAsstFndDelt = "k_baseAssetDelta" | |
41 | 41 | ||
42 | 42 | let k_totalPositionSize = "k_totalPositionSize" | |
43 | 43 | ||
44 | 44 | let k_cumulativeNotional = "k_cumulativeNotional" | |
45 | 45 | ||
46 | 46 | let k_openInteresetNotional = "k_openInteresetNotional" | |
47 | 47 | ||
48 | 48 | let ADMIN_ADDRESS = Address(base58'3Mz1td457M34EA7wU1swt2DBQDZEDpsMtgE') | |
49 | 49 | ||
50 | 50 | let ADMIN_PUBLIC_KEY = base58'DKoVYQRirYnan4ojiUkT12oE6XmpyNoht3ZcecUpgLsf' | |
51 | 51 | ||
52 | 52 | let USDN = base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ' | |
53 | 53 | ||
54 | 54 | let USDN_STAKING = Address(base58'3N9LkJahTMx41wGhSxLS42prCZtRCp4dhTs') | |
55 | 55 | ||
56 | 56 | let FEES_ACCOUNT = Address(base58'3MseEJNEHkYhvcHre6Mann1F8e27S1qptdg') | |
57 | 57 | ||
58 | 58 | let INSURANCE_ADDRESS = Address(base58'3N2qeokoCMkNrCkh5EFfZMFYN7Krun5ZFxJ') | |
59 | 59 | ||
60 | 60 | let DIR_LONG = 1 | |
61 | 61 | ||
62 | 62 | let DIR_SHORT = 2 | |
63 | 63 | ||
64 | 64 | let FUNDING_BLOCK_INTERVAL = 60 | |
65 | 65 | ||
66 | 66 | let SECONDS = 1000 | |
67 | 67 | ||
68 | 68 | let DECIMAL_UNIT = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
69 | 69 | ||
70 | 70 | let ONE_DAY = (86400 * DECIMAL_UNIT) | |
71 | 71 | ||
72 | 72 | func s (_x) = (toString(_x) + ",") | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func abs (_x) = if ((_x > 0)) | |
82 | 82 | then _x | |
83 | 83 | else -(_x) | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func requireMoreMarginRatio (_marginRatio,_baseMarginRatio,_largerThanOrEqualTo) = { | |
90 | 90 | let remainingMarginRatio = (_marginRatio - _baseMarginRatio) | |
91 | 91 | if (if (_largerThanOrEqualTo) | |
92 | 92 | then (0 > remainingMarginRatio) | |
93 | 93 | else false) | |
94 | 94 | then throw("Invalid margin") | |
95 | 95 | else if (if (!(_largerThanOrEqualTo)) | |
96 | 96 | then (remainingMarginRatio >= 0) | |
97 | 97 | else false) | |
98 | 98 | then throw("Invalid margin") | |
99 | 99 | else true | |
100 | 100 | } | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k)) | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func cbalance () = int(k_balance) | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func fee () = int(k_fee) | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func initMarginRatio () = int(k_initMarginRatio) | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func qtAstR () = int(k_qtAstR) | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func bsAstR () = int(k_bsAstR) | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func baseAsstFndDelt () = int(k_baseAsstFndDelt) | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func totalPositionSize () = int(k_totalPositionSize) | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func cumulativeNotional () = int(k_cumulativeNotional) | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func latestCPF () = int(k_latestCPF) | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func openInteresetNotional () = int(k_openInteresetNotional) | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func nextFundingBlockTimestamp () = int(k_nextFundingBlock) | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func fundingPeriodRaw () = int(k_fundingPeriod) | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | func fundingPeriodDecimal () = (fundingPeriodRaw() * DECIMAL_UNIT) | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | func fundingPeriodSeconds () = (fundingPeriodRaw() * SECONDS) | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | func mmr () = int(k_mmr) | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | func liquidationFeeRatio () = int(k_liquidationFeeRatio) | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func getPosition (invesor) = { | |
155 | 155 | let positionSizeOpt = getInteger(this, toCompositeKey(k_positionSize, invesor)) | |
156 | 156 | match positionSizeOpt { | |
157 | 157 | case positionSize: Int => | |
158 | 158 | $Tuple4(positionSize, getIntegerValue(this, toCompositeKey(k_positionMargin, invesor)), getIntegerValue(this, toCompositeKey(k_pon, invesor)), getIntegerValue(this, toCompositeKey(k_positionLstUpdCPF, invesor))) | |
159 | 159 | case _ => | |
160 | 160 | $Tuple4(0, 0, 0, 0) | |
161 | 161 | } | |
162 | 162 | } | |
163 | 163 | ||
164 | 164 | ||
165 | - | func requireOpenPosition (_trader) = { | |
166 | - | let $t039534064 = getPosition(_trader) | |
167 | - | let positionSize = $t039534064._1 | |
168 | - | let positionMargin = $t039534064._2 | |
169 | - | let pon = $t039534064._3 | |
170 | - | let positionLstUpdCPF = $t039534064._4 | |
171 | - | if ((positionSize == 0)) | |
172 | - | then throw("No open position") | |
173 | - | else true | |
174 | - | } | |
165 | + | func requireOpenPosition (_trader) = if ((getPosition(_trader)._1 == 0)) | |
166 | + | then throw("No open position") | |
167 | + | else true | |
175 | 168 | ||
176 | 169 | ||
177 | 170 | func initialized () = valueOrElse(getBoolean(this, k_initialized), false) | |
178 | 171 | ||
179 | 172 | ||
180 | 173 | func updateReserve (_isAdd,_quoteAssetAmount,_baseAssetAmount) = if (_isAdd) | |
181 | - | then $Tuple5((qtAstR() + _quoteAssetAmount), (bsAstR() - _baseAssetAmount), (baseAsstFndDelt() - _baseAssetAmount), (totalPositionSize() + _baseAssetAmount), (cumulativeNotional() + _quoteAssetAmount)) | |
182 | - | else $Tuple5((qtAstR() - _quoteAssetAmount), (bsAstR() + _baseAssetAmount), (baseAsstFndDelt() + _baseAssetAmount), (totalPositionSize() - _baseAssetAmount), (cumulativeNotional() - _quoteAssetAmount)) | |
174 | + | then { | |
175 | + | let newBase = (bsAstR() - _baseAssetAmount) | |
176 | + | if ((0 >= newBase)) | |
177 | + | then throw("Tx lead to base asset reserver <= 0, revert") | |
178 | + | else $Tuple5((qtAstR() + _quoteAssetAmount), newBase, (baseAsstFndDelt() - _baseAssetAmount), (totalPositionSize() + _baseAssetAmount), (cumulativeNotional() + _quoteAssetAmount)) | |
179 | + | } | |
180 | + | else { | |
181 | + | let newQuote = (qtAstR() - _quoteAssetAmount) | |
182 | + | if ((0 >= newQuote)) | |
183 | + | then throw("Tx lead to base quote reserver <= 0, revert") | |
184 | + | else $Tuple5(newQuote, (bsAstR() + _baseAssetAmount), (baseAsstFndDelt() + _baseAssetAmount), (totalPositionSize() - _baseAssetAmount), (cumulativeNotional() - _quoteAssetAmount)) | |
185 | + | } | |
183 | 186 | ||
184 | 187 | ||
185 | 188 | func swapInput (_isAdd,_quoteAssetAmoun) = { | |
186 | 189 | let _qtAstR = qtAstR() | |
187 | 190 | let _bsAstR = bsAstR() | |
188 | 191 | let k = muld(_qtAstR, _bsAstR) | |
189 | 192 | let qtAstRAfter = if (_isAdd) | |
190 | 193 | then (_qtAstR + _quoteAssetAmoun) | |
191 | 194 | else (_qtAstR - _quoteAssetAmoun) | |
192 | 195 | let bsAstRAfter = divd(k, qtAstRAfter) | |
193 | 196 | let amountBaseAssetBoughtAbs = abs((bsAstRAfter - _bsAstR)) | |
194 | 197 | let amountBaseAssetBought = if (_isAdd) | |
195 | 198 | then amountBaseAssetBoughtAbs | |
196 | 199 | else -(amountBaseAssetBoughtAbs) | |
197 | - | let $ | |
198 | - | let qtAstRAfter1 = $ | |
199 | - | let bsAstRAfter1 = $ | |
200 | - | let baseAsstFndDeltAfter1 = $ | |
201 | - | let totalPositionSizeAfter1 = $ | |
202 | - | let cumulativeNotionalAfter1 = $ | |
200 | + | let $t055655763 = updateReserve(_isAdd, _quoteAssetAmoun, amountBaseAssetBoughtAbs) | |
201 | + | let qtAstRAfter1 = $t055655763._1 | |
202 | + | let bsAstRAfter1 = $t055655763._2 | |
203 | + | let baseAsstFndDeltAfter1 = $t055655763._3 | |
204 | + | let totalPositionSizeAfter1 = $t055655763._4 | |
205 | + | let cumulativeNotionalAfter1 = $t055655763._5 | |
203 | 206 | $Tuple6(amountBaseAssetBought, qtAstRAfter1, bsAstRAfter1, baseAsstFndDeltAfter1, totalPositionSizeAfter1, cumulativeNotionalAfter1) | |
204 | 207 | } | |
205 | 208 | ||
206 | 209 | ||
207 | 210 | func calcRemainMarginWithFundingPayment (_oldPositionSize,_oldPositionMargin,_oldPositionLstUpdCPF,_marginDelta) = { | |
208 | 211 | let _latestCPF = latestCPF() | |
209 | 212 | let fundingPayment = if ((_oldPositionSize != 0)) | |
210 | 213 | then muld((_latestCPF - _oldPositionLstUpdCPF), _oldPositionSize) | |
211 | 214 | else 0 | |
212 | 215 | let signedMargin = ((_marginDelta - fundingPayment) + _oldPositionMargin) | |
213 | - | let $ | |
216 | + | let $t063376464 = if ((0 > signedMargin)) | |
214 | 217 | then $Tuple2(0, abs(signedMargin)) | |
215 | 218 | else $Tuple2(abs(signedMargin), 0) | |
216 | - | let remainMargin = $ | |
217 | - | let badDebt = $ | |
219 | + | let remainMargin = $t063376464._1 | |
220 | + | let badDebt = $t063376464._2 | |
218 | 221 | $Tuple4(remainMargin, badDebt, fundingPayment, _latestCPF) | |
219 | 222 | } | |
220 | 223 | ||
221 | 224 | ||
222 | 225 | func getOutputPriceWithReserves (_add,_baseAssetAmount,_quoteAssetPoolAmount,_baseAssetPoolAmount) = if ((_baseAssetAmount == 0)) | |
223 | 226 | then throw("Invalid base asset amount") | |
224 | 227 | else { | |
225 | 228 | let k = muld(_quoteAssetPoolAmount, _baseAssetPoolAmount) | |
226 | 229 | let baseAssetPoolAmountAfter = if (_add) | |
227 | 230 | then (_baseAssetPoolAmount + _baseAssetAmount) | |
228 | 231 | else (_baseAssetPoolAmount - _baseAssetAmount) | |
229 | 232 | let quoteAssetAfter = divd(k, baseAssetPoolAmountAfter) | |
230 | 233 | let quoteAssetSold = abs((quoteAssetAfter - _quoteAssetPoolAmount)) | |
231 | - | let $ | |
232 | - | let qtAstRAfter1 = $ | |
233 | - | let bsAstRAfter1 = $ | |
234 | - | let baseAsstFndDeltAfter1 = $ | |
235 | - | let totalPositionSizeAfter1 = $ | |
236 | - | let cumulativeNotionalAfter1 = $ | |
234 | + | let $t071137312 = updateReserve(!(_add), quoteAssetSold, _baseAssetAmount) | |
235 | + | let qtAstRAfter1 = $t071137312._1 | |
236 | + | let bsAstRAfter1 = $t071137312._2 | |
237 | + | let baseAsstFndDeltAfter1 = $t071137312._3 | |
238 | + | let totalPositionSizeAfter1 = $t071137312._4 | |
239 | + | let cumulativeNotionalAfter1 = $t071137312._5 | |
237 | 240 | $Tuple6(quoteAssetSold, qtAstRAfter1, bsAstRAfter1, baseAsstFndDeltAfter1, totalPositionSizeAfter1, cumulativeNotionalAfter1) | |
238 | 241 | } | |
239 | 242 | ||
240 | 243 | ||
241 | 244 | func getPositionNotionalAndUnrealizedPnl (_trader) = { | |
242 | - | let $ | |
243 | - | let positionSize = $ | |
244 | - | let positionMargin = $ | |
245 | - | let pon = $ | |
246 | - | let positionLstUpdCPF = $ | |
245 | + | let $t075507661 = getPosition(_trader) | |
246 | + | let positionSize = $t075507661._1 | |
247 | + | let positionMargin = $t075507661._2 | |
248 | + | let pon = $t075507661._3 | |
249 | + | let positionLstUpdCPF = $t075507661._4 | |
247 | 250 | let positionSizeAbs = abs(positionSize) | |
248 | 251 | if ((positionSizeAbs == 0)) | |
249 | 252 | then throw("Invalid position size") | |
250 | 253 | else { | |
251 | 254 | let isShort = (0 > positionSize) | |
252 | - | let $ | |
253 | - | let positionNotional = $ | |
254 | - | let x1 = $ | |
255 | - | let x2 = $ | |
256 | - | let x3 = $ | |
255 | + | let $t078387988 = getOutputPriceWithReserves(!(isShort), positionSizeAbs, qtAstR(), bsAstR()) | |
256 | + | let positionNotional = $t078387988._1 | |
257 | + | let x1 = $t078387988._2 | |
258 | + | let x2 = $t078387988._3 | |
259 | + | let x3 = $t078387988._4 | |
257 | 260 | let unrealizedPnl = if (isShort) | |
258 | 261 | then (pon - positionNotional) | |
259 | 262 | else (positionNotional - pon) | |
260 | 263 | $Tuple2(positionNotional, unrealizedPnl) | |
261 | 264 | } | |
262 | 265 | } | |
263 | 266 | ||
264 | 267 | ||
265 | 268 | func getOracleTwapPrice () = { | |
266 | 269 | let oracle = valueOrErrorMessage(addressFromString(getStringValue(this, k_ora)), "") | |
267 | 270 | let priceKey = getStringValue(this, k_ora_key) | |
268 | 271 | getIntegerValue(oracle, priceKey) | |
269 | 272 | } | |
270 | 273 | ||
271 | 274 | ||
272 | 275 | func getTwapSpotPrice () = divd(qtAstR(), bsAstR()) | |
273 | 276 | ||
274 | 277 | ||
275 | 278 | func getMarginRatio (_trader) = { | |
276 | - | let $ | |
277 | - | let positionSize = $ | |
278 | - | let positionMargin = $ | |
279 | - | let pon = $ | |
280 | - | let positionLstUpdCPF = $ | |
281 | - | let $ | |
282 | - | let positionNotional = $ | |
283 | - | let unrealizedPnl = $ | |
284 | - | let $ | |
285 | - | let remainMargin = $ | |
286 | - | let badDebt = $ | |
279 | + | let $t084988609 = getPosition(_trader) | |
280 | + | let positionSize = $t084988609._1 | |
281 | + | let positionMargin = $t084988609._2 | |
282 | + | let pon = $t084988609._3 | |
283 | + | let positionLstUpdCPF = $t084988609._4 | |
284 | + | let $t086158699 = getPositionNotionalAndUnrealizedPnl(_trader) | |
285 | + | let positionNotional = $t086158699._1 | |
286 | + | let unrealizedPnl = $t086158699._2 | |
287 | + | let $t087048870 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
288 | + | let remainMargin = $t087048870._1 | |
289 | + | let badDebt = $t087048870._2 | |
287 | 290 | divd((remainMargin - badDebt), positionNotional) | |
288 | 291 | } | |
289 | 292 | ||
290 | 293 | ||
291 | 294 | func internalClosePosition (_trader) = { | |
292 | - | let $ | |
293 | - | let positionSize = $ | |
294 | - | let positionMargin = $ | |
295 | - | let pon = $ | |
296 | - | let positionLstUpdCPF = $ | |
297 | - | let $ | |
298 | - | let x1 = $ | |
299 | - | let unrealizedPnl = $ | |
300 | - | let $ | |
301 | - | let remainMargin = $ | |
302 | - | let badDebt = $ | |
303 | - | let x2 = $ | |
295 | + | let $t089779088 = getPosition(_trader) | |
296 | + | let positionSize = $t089779088._1 | |
297 | + | let positionMargin = $t089779088._2 | |
298 | + | let pon = $t089779088._3 | |
299 | + | let positionLstUpdCPF = $t089779088._4 | |
300 | + | let $t090949164 = getPositionNotionalAndUnrealizedPnl(_trader) | |
301 | + | let x1 = $t090949164._1 | |
302 | + | let unrealizedPnl = $t090949164._2 | |
303 | + | let $t091699341 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
304 | + | let remainMargin = $t091699341._1 | |
305 | + | let badDebt = $t091699341._2 | |
306 | + | let x2 = $t091699341._3 | |
304 | 307 | let exchangedPositionSize = -(positionSize) | |
305 | 308 | let realizedPnl = unrealizedPnl | |
306 | 309 | let marginToVault = -(remainMargin) | |
307 | - | let $ | |
308 | - | let exchangedQuoteAssetAmount = $ | |
309 | - | let quoteAssetReserveAfter = $ | |
310 | - | let bsAstRAfter = $ | |
311 | - | let baseAsstFndDeltAfter = $ | |
312 | - | let totalPositionSizeAfter = $ | |
313 | - | let cumulativeNotionalAfter = $ | |
310 | + | let $t094689775 = getOutputPriceWithReserves((positionSize > 0), abs(positionSize), qtAstR(), bsAstR()) | |
311 | + | let exchangedQuoteAssetAmount = $t094689775._1 | |
312 | + | let quoteAssetReserveAfter = $t094689775._2 | |
313 | + | let bsAstRAfter = $t094689775._3 | |
314 | + | let baseAsstFndDeltAfter = $t094689775._4 | |
315 | + | let totalPositionSizeAfter = $t094689775._5 | |
316 | + | let cumulativeNotionalAfter = $t094689775._6 | |
314 | 317 | let openInteresetNotionalAfter = (openInteresetNotional() - pon) | |
315 | 318 | $Tuple11(exchangedPositionSize, badDebt, realizedPnl, marginToVault, quoteAssetReserveAfter, bsAstRAfter, baseAsstFndDeltAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInteresetNotionalAfter, exchangedQuoteAssetAmount) | |
316 | 319 | } | |
317 | 320 | ||
318 | 321 | ||
319 | 322 | func updateSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee) = [IntegerEntry(k_initMarginRatio, _initMarginRatio), IntegerEntry(k_mmr, _mmr), IntegerEntry(k_liquidationFeeRatio, _liquidationFeeRatio), IntegerEntry(k_fundingPeriod, _fundingPeriod), IntegerEntry(k_fee, _fee)] | |
320 | 323 | ||
321 | 324 | ||
322 | 325 | func updateFunding (_baseADTFP,_nextFundingBlock,_latestCPF,_fundingRate) = [IntegerEntry(k_baseAsstFndDelt, _baseADTFP), IntegerEntry(k_nextFundingBlock, _nextFundingBlock), IntegerEntry(k_latestCPF, _latestCPF), IntegerEntry(k_fundingRate, _fundingRate)] | |
323 | 326 | ||
324 | 327 | ||
325 | 328 | func updatePosition (_address,_size,_margin,_openNotinal,_LstUpdCPF) = [IntegerEntry(toCompositeKey(k_positionSize, _address), _size), IntegerEntry(toCompositeKey(k_positionMargin, _address), _margin), IntegerEntry(toCompositeKey(k_pon, _address), _openNotinal), IntegerEntry(toCompositeKey(k_positionLstUpdCPF, _address), _LstUpdCPF)] | |
326 | 329 | ||
327 | 330 | ||
328 | 331 | func updateAmm (_qtAstR,_bsAstR,_baseAsstFndDeltAfter,_totalPositionSizeAfter,_cumulativeNotionalAfter,_openInteresetNotional) = [IntegerEntry(k_qtAstR, _qtAstR), IntegerEntry(k_bsAstR, _bsAstR), IntegerEntry(k_baseAsstFndDelt, _baseAsstFndDeltAfter), IntegerEntry(k_totalPositionSize, _totalPositionSizeAfter), IntegerEntry(k_cumulativeNotional, _cumulativeNotionalAfter), IntegerEntry(k_openInteresetNotional, _openInteresetNotional)] | |
329 | 332 | ||
330 | 333 | ||
331 | 334 | func deletePosition (_address) = [DeleteEntry(toCompositeKey(k_positionSize, _address)), DeleteEntry(toCompositeKey(k_positionMargin, _address)), DeleteEntry(toCompositeKey(k_pon, _address)), DeleteEntry(toCompositeKey(k_positionLstUpdCPF, _address))] | |
332 | 335 | ||
333 | 336 | ||
334 | 337 | func withdraw (_address,_amount) = { | |
335 | 338 | let balance = assetBalance(this, USDN) | |
336 | 339 | if ((_amount > balance)) | |
337 | 340 | then throw(((("Unable to withdraw " + toString(_amount)) + " from contract balance ") + toString(balance))) | |
338 | 341 | else [ScriptTransfer(_address, _amount, USDN)] | |
339 | 342 | } | |
340 | 343 | ||
341 | 344 | ||
342 | 345 | func writeConstants () = [StringEntry("ADMIN_ADDRESS", toString(ADMIN_ADDRESS)), StringEntry("USDN", toBase58String(USDN)), StringEntry("USDN_STAKING", toString(USDN_STAKING))] | |
343 | 346 | ||
344 | 347 | ||
345 | 348 | func upblc (i) = if ((0 > i)) | |
346 | 349 | then throw("Balance") | |
347 | 350 | else [IntegerEntry(k_balance, i)] | |
348 | 351 | ||
349 | 352 | ||
350 | 353 | func transferFee (i) = [ScriptTransfer(FEES_ACCOUNT, i, USDN)] | |
351 | 354 | ||
352 | 355 | ||
353 | 356 | @Callable(i) | |
354 | 357 | func initialize (_qtAstR,_bsAstR,_fundingPeriod,_initMarginRatio,_mmr,_liquidationFeeRatio,_fee,_oracle,_oracleKey) = if (if (if (if (if (if (if (if ((0 >= _qtAstR)) | |
355 | 358 | then true | |
356 | 359 | else (0 >= _bsAstR)) | |
357 | 360 | then true | |
358 | 361 | else (0 >= _fundingPeriod)) | |
359 | 362 | then true | |
360 | 363 | else (0 >= _initMarginRatio)) | |
361 | 364 | then true | |
362 | 365 | else (0 >= _mmr)) | |
363 | 366 | then true | |
364 | 367 | else (0 >= _liquidationFeeRatio)) | |
365 | 368 | then true | |
366 | 369 | else (i.caller != ADMIN_ADDRESS)) | |
367 | 370 | then true | |
368 | 371 | else initialized()) | |
369 | 372 | then throw("Invalid initialize parameters") | |
370 | 373 | else (((((updateAmm(_qtAstR, _bsAstR, 0, 0, 0, 0) ++ updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee)) ++ updateFunding(0, (lastBlock.timestamp + _fundingPeriod), 0, 0)) ++ upblc(0)) ++ writeConstants()) ++ [BooleanEntry(k_initialized, true), StringEntry(k_ora, _oracle), StringEntry(k_ora_key, _oracleKey)]) | |
371 | 374 | ||
372 | 375 | ||
373 | 376 | ||
374 | 377 | @Callable(i) | |
375 | 378 | func decreasePosition (_direction,_amount,_leverage,_minBaseAssetAmount) = if (if (if (if (if (if ((_direction != DIR_LONG)) | |
376 | 379 | then (_direction != DIR_SHORT) | |
377 | 380 | else false) | |
378 | 381 | then true | |
379 | 382 | else (0 >= _amount)) | |
380 | 383 | then true | |
381 | 384 | else if (((1 * DECIMAL_UNIT) > _leverage)) | |
382 | 385 | then true | |
383 | 386 | else (_leverage > (3 * DECIMAL_UNIT))) | |
384 | 387 | then true | |
385 | 388 | else !(initialized())) | |
386 | 389 | then true | |
387 | 390 | else !(requireMoreMarginRatio(divd(DECIMAL_UNIT, _leverage), initMarginRatio(), true))) | |
388 | 391 | then throw("Invalid decreasePosition parameters") | |
389 | 392 | else { | |
390 | - | let $ | |
391 | - | let oldPositionSize = $ | |
392 | - | let oldPositionMargin = $ | |
393 | - | let oldPositionOpenNotional = $ | |
394 | - | let oldPositionLstUpdCPF = $ | |
393 | + | let $t01416814320 = getPosition(toString(i.caller)) | |
394 | + | let oldPositionSize = $t01416814320._1 | |
395 | + | let oldPositionMargin = $t01416814320._2 | |
396 | + | let oldPositionOpenNotional = $t01416814320._3 | |
397 | + | let oldPositionLstUpdCPF = $t01416814320._4 | |
395 | 398 | let isNewPosition = (oldPositionSize == 0) | |
396 | 399 | let isSameDirection = if ((oldPositionSize > 0)) | |
397 | 400 | then (_direction == DIR_LONG) | |
398 | 401 | else (_direction == DIR_SHORT) | |
399 | 402 | let expandExisting = if (!(isNewPosition)) | |
400 | 403 | then isSameDirection | |
401 | 404 | else false | |
402 | 405 | let isAdd = (_direction == DIR_LONG) | |
403 | - | let $ | |
406 | + | let $t01460917342 = if (if (isNewPosition) | |
404 | 407 | then true | |
405 | 408 | else expandExisting) | |
406 | 409 | then throw("Use increasePosition to open new or increase position") | |
407 | 410 | else { | |
408 | 411 | let openNotional = muld(_amount, _leverage) | |
409 | - | let $ | |
410 | - | let oldPositionNotional = $ | |
411 | - | let unrealizedPnl = $ | |
412 | + | let $t01507715176 = getPositionNotionalAndUnrealizedPnl(toString(i.caller)) | |
413 | + | let oldPositionNotional = $t01507715176._1 | |
414 | + | let unrealizedPnl = $t01507715176._2 | |
412 | 415 | if ((oldPositionNotional > openNotional)) | |
413 | 416 | then { | |
414 | - | let $ | |
415 | - | let exchangedPositionSize = $ | |
416 | - | let qtAstRAfter = $ | |
417 | - | let bsAstRAfter = $ | |
418 | - | let baseAsstFndDeltAfter = $ | |
419 | - | let totalPositionSizeAfter = $ | |
420 | - | let cumulativeNotionalAfter = $ | |
417 | + | let $t01523815481 = swapInput(isAdd, openNotional) | |
418 | + | let exchangedPositionSize = $t01523815481._1 | |
419 | + | let qtAstRAfter = $t01523815481._2 | |
420 | + | let bsAstRAfter = $t01523815481._3 | |
421 | + | let baseAsstFndDeltAfter = $t01523815481._4 | |
422 | + | let totalPositionSizeAfter = $t01523815481._5 | |
423 | + | let cumulativeNotionalAfter = $t01523815481._6 | |
421 | 424 | let exchangedPositionSizeAbs = abs(exchangedPositionSize) | |
422 | 425 | if (if ((_minBaseAssetAmount != 0)) | |
423 | 426 | then (_minBaseAssetAmount > exchangedPositionSizeAbs) | |
424 | 427 | else false) | |
425 | 428 | then throw(((("Too little basse asset exchanged, got " + toString(exchangedPositionSizeAbs)) + " expected ") + toString(_minBaseAssetAmount))) | |
426 | 429 | else { | |
427 | 430 | let realizedPnl = if ((oldPositionSize != 0)) | |
428 | 431 | then divd(muld(unrealizedPnl, exchangedPositionSizeAbs), oldPositionSize) | |
429 | 432 | else 0 | |
430 | - | let $ | |
431 | - | let remainMargin = $ | |
432 | - | let badDebt = $ | |
433 | - | let fundingPayment = $ | |
434 | - | let oldLatestCPF = $ | |
433 | + | let $t01602216293 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl) | |
434 | + | let remainMargin = $t01602216293._1 | |
435 | + | let badDebt = $t01602216293._2 | |
436 | + | let fundingPayment = $t01602216293._3 | |
437 | + | let oldLatestCPF = $t01602216293._4 | |
435 | 438 | let exchangedQuoteAssetAmount = openNotional | |
436 | 439 | let unrealizedPnlAfter = (unrealizedPnl - realizedPnl) | |
437 | 440 | let remainOpenNotional = if ((oldPositionSize > 0)) | |
438 | 441 | then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter) | |
439 | 442 | else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount) | |
440 | 443 | $Tuple10((oldPositionSize + exchangedPositionSize), remainMargin, abs(remainOpenNotional), oldLatestCPF, bsAstRAfter, qtAstRAfter, baseAsstFndDeltAfter, totalPositionSizeAfter, cumulativeNotionalAfter, (openInteresetNotional() - openNotional)) | |
441 | 444 | } | |
442 | 445 | } | |
443 | 446 | else throw("Close position first") | |
444 | 447 | } | |
445 | - | let newPositionSize = $ | |
446 | - | let newPositionRemainMargin = $ | |
447 | - | let newPosiionOpenNotional = $ | |
448 | - | let newPositionLatestCPF = $ | |
449 | - | let bsAstRAfter = $ | |
450 | - | let qtAstRAfter = $ | |
451 | - | let baseAsstFndDeltAfter = $ | |
452 | - | let totalPositionSizeAfter = $ | |
453 | - | let cumulativeNotionalAfter = $ | |
454 | - | let openInteresetNotionalAfter = $ | |
448 | + | let newPositionSize = $t01460917342._1 | |
449 | + | let newPositionRemainMargin = $t01460917342._2 | |
450 | + | let newPosiionOpenNotional = $t01460917342._3 | |
451 | + | let newPositionLatestCPF = $t01460917342._4 | |
452 | + | let bsAstRAfter = $t01460917342._5 | |
453 | + | let qtAstRAfter = $t01460917342._6 | |
454 | + | let baseAsstFndDeltAfter = $t01460917342._7 | |
455 | + | let totalPositionSizeAfter = $t01460917342._8 | |
456 | + | let cumulativeNotionalAfter = $t01460917342._9 | |
457 | + | let openInteresetNotionalAfter = $t01460917342._10 | |
455 | 458 | (updatePosition(toString(i.caller), newPositionSize, newPositionRemainMargin, newPosiionOpenNotional, newPositionLatestCPF) ++ updateAmm(qtAstRAfter, bsAstRAfter, baseAsstFndDeltAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInteresetNotionalAfter)) | |
456 | 459 | } | |
457 | 460 | ||
458 | 461 | ||
459 | 462 | ||
460 | 463 | @Callable(i) | |
461 | 464 | func increasePosition (_direction,_leverage,_minBaseAssetAmount) = { | |
462 | 465 | let _rawAmount = i.payments[0].amount | |
463 | 466 | if (if (if (if (if (if (if ((_direction != DIR_LONG)) | |
464 | 467 | then (_direction != DIR_SHORT) | |
465 | 468 | else false) | |
466 | 469 | then true | |
467 | 470 | else (0 >= _rawAmount)) | |
468 | 471 | then true | |
469 | 472 | else if (((1 * DECIMAL_UNIT) > _leverage)) | |
470 | 473 | then true | |
471 | 474 | else (_leverage > (3 * DECIMAL_UNIT))) | |
472 | 475 | then true | |
473 | 476 | else !(initialized())) | |
474 | 477 | then true | |
475 | 478 | else (i.payments[0].assetId != USDN)) | |
476 | 479 | then true | |
477 | 480 | else !(requireMoreMarginRatio(divd(DECIMAL_UNIT, _leverage), initMarginRatio(), true))) | |
478 | 481 | then throw("Invalid increasePosition parameters") | |
479 | 482 | else { | |
480 | 483 | let feeAmount = muld(_rawAmount, fee()) | |
481 | 484 | let _amount = (_rawAmount - feeAmount) | |
482 | - | let $ | |
483 | - | let oldPositionSize = $ | |
484 | - | let oldPositionMargin = $ | |
485 | - | let oldPositionOpenNotional = $ | |
486 | - | let oldPositionLstUpdCPF = $ | |
485 | + | let $t01831618468 = getPosition(toString(i.caller)) | |
486 | + | let oldPositionSize = $t01831618468._1 | |
487 | + | let oldPositionMargin = $t01831618468._2 | |
488 | + | let oldPositionOpenNotional = $t01831618468._3 | |
489 | + | let oldPositionLstUpdCPF = $t01831618468._4 | |
487 | 490 | let isNewPosition = (oldPositionSize == 0) | |
488 | 491 | let isSameDirection = if ((oldPositionSize > 0)) | |
489 | 492 | then (_direction == DIR_LONG) | |
490 | 493 | else (_direction == DIR_SHORT) | |
491 | 494 | let expandExisting = if (!(isNewPosition)) | |
492 | 495 | then isSameDirection | |
493 | 496 | else false | |
494 | 497 | let isAdd = (_direction == DIR_LONG) | |
495 | - | let $ | |
498 | + | let $t01875720881 = if (if (isNewPosition) | |
496 | 499 | then true | |
497 | 500 | else expandExisting) | |
498 | 501 | then { | |
499 | 502 | let openNotional = muld(_amount, _leverage) | |
500 | - | let $ | |
501 | - | let amountBaseAssetBought = $ | |
502 | - | let qtAstRAfter = $ | |
503 | - | let bsAstRAfter = $ | |
504 | - | let baseAsstFndDeltAfter = $ | |
505 | - | let totalPositionSizeAfter = $ | |
506 | - | let cumulativeNotionalAfter = $ | |
503 | + | let $t01914319358 = swapInput(isAdd, openNotional) | |
504 | + | let amountBaseAssetBought = $t01914319358._1 | |
505 | + | let qtAstRAfter = $t01914319358._2 | |
506 | + | let bsAstRAfter = $t01914319358._3 | |
507 | + | let baseAsstFndDeltAfter = $t01914319358._4 | |
508 | + | let totalPositionSizeAfter = $t01914319358._5 | |
509 | + | let cumulativeNotionalAfter = $t01914319358._6 | |
507 | 510 | if (if ((_minBaseAssetAmount != 0)) | |
508 | 511 | then (_minBaseAssetAmount > abs(amountBaseAssetBought)) | |
509 | 512 | else false) | |
510 | 513 | then throw(((("Limit error: " + toString(abs(amountBaseAssetBought))) + " < ") + toString(_minBaseAssetAmount))) | |
511 | 514 | else { | |
512 | 515 | let newPositionSize = (oldPositionSize + amountBaseAssetBought) | |
513 | 516 | let increaseMarginRequirement = divd(openNotional, _leverage) | |
514 | - | let $ | |
515 | - | let remainMargin = $ | |
516 | - | let x1 = $ | |
517 | - | let x2 = $ | |
518 | - | let oldLatestCPF = $ | |
517 | + | let $t01973919992 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, increaseMarginRequirement) | |
518 | + | let remainMargin = $t01973919992._1 | |
519 | + | let x1 = $t01973919992._2 | |
520 | + | let x2 = $t01973919992._3 | |
521 | + | let oldLatestCPF = $t01973919992._4 | |
519 | 522 | $Tuple10(newPositionSize, remainMargin, (oldPositionOpenNotional + openNotional), oldLatestCPF, bsAstRAfter, qtAstRAfter, baseAsstFndDeltAfter, totalPositionSizeAfter, cumulativeNotionalAfter, (openInteresetNotional() + openNotional)) | |
520 | 523 | } | |
521 | 524 | } | |
522 | 525 | else { | |
523 | 526 | let openNotional = muld(_amount, _leverage) | |
524 | - | let $ | |
525 | - | let oldPositionNotional = $ | |
526 | - | let unrealizedPnl = $ | |
527 | + | let $t02059120690 = getPositionNotionalAndUnrealizedPnl(toString(i.caller)) | |
528 | + | let oldPositionNotional = $t02059120690._1 | |
529 | + | let unrealizedPnl = $t02059120690._2 | |
527 | 530 | if ((oldPositionNotional > openNotional)) | |
528 | 531 | then throw("Use decreasePosition to decrease position size") | |
529 | 532 | else throw("Close position first") | |
530 | 533 | } | |
531 | - | let newPositionSize = $ | |
532 | - | let newPositionRemainMargin = $ | |
533 | - | let newPosiionOpenNotional = $ | |
534 | - | let newPositionLatestCPF = $ | |
535 | - | let bsAstRAfter = $ | |
536 | - | let qtAstRAfter = $ | |
537 | - | let baseAsstFndDeltAfter = $ | |
538 | - | let totalPositionSizeAfter = $ | |
539 | - | let cumulativeNotionalAfter = $ | |
540 | - | let openInteresetNotionalAfter = $ | |
534 | + | let newPositionSize = $t01875720881._1 | |
535 | + | let newPositionRemainMargin = $t01875720881._2 | |
536 | + | let newPosiionOpenNotional = $t01875720881._3 | |
537 | + | let newPositionLatestCPF = $t01875720881._4 | |
538 | + | let bsAstRAfter = $t01875720881._5 | |
539 | + | let qtAstRAfter = $t01875720881._6 | |
540 | + | let baseAsstFndDeltAfter = $t01875720881._7 | |
541 | + | let totalPositionSizeAfter = $t01875720881._8 | |
542 | + | let cumulativeNotionalAfter = $t01875720881._9 | |
543 | + | let openInteresetNotionalAfter = $t01875720881._10 | |
541 | 544 | let stake = invoke(USDN_STAKING, "lockNeutrino", nil, [AttachedPayment(USDN, _amount)]) | |
542 | 545 | if ((stake == stake)) | |
543 | 546 | then (((updatePosition(toString(i.caller), newPositionSize, newPositionRemainMargin, newPosiionOpenNotional, newPositionLatestCPF) ++ updateAmm(qtAstRAfter, bsAstRAfter, baseAsstFndDeltAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInteresetNotionalAfter)) ++ transferFee(feeAmount)) ++ upblc((cbalance() + _amount))) | |
544 | 547 | else throw("Strict value is not equal to itself.") | |
545 | 548 | } | |
546 | 549 | } | |
547 | 550 | ||
548 | 551 | ||
549 | 552 | ||
550 | 553 | @Callable(i) | |
551 | 554 | func addMargin () = { | |
552 | 555 | let _rawAmount = i.payments[0].amount | |
553 | 556 | if (if ((i.payments[0].assetId != USDN)) | |
554 | 557 | then true | |
555 | 558 | else !(requireOpenPosition(toString(i.caller)))) | |
556 | 559 | then throw("Invalid addMargin parameters") | |
557 | 560 | else { | |
558 | 561 | let feeAmount = muld(_rawAmount, fee()) | |
559 | 562 | let _amount = (_rawAmount - feeAmount) | |
560 | - | let $ | |
561 | - | let oldPositionSize = $ | |
562 | - | let oldPositionMargin = $ | |
563 | - | let oldPositionOpenNotional = $ | |
564 | - | let oldPositionLstUpdCPF = $ | |
563 | + | let $t02176721919 = getPosition(toString(i.caller)) | |
564 | + | let oldPositionSize = $t02176721919._1 | |
565 | + | let oldPositionMargin = $t02176721919._2 | |
566 | + | let oldPositionOpenNotional = $t02176721919._3 | |
567 | + | let oldPositionLstUpdCPF = $t02176721919._4 | |
565 | 568 | let stake = invoke(USDN_STAKING, "lockNeutrino", nil, [AttachedPayment(USDN, _amount)]) | |
566 | 569 | if ((stake == stake)) | |
567 | 570 | then ((updatePosition(toString(i.caller), oldPositionSize, (oldPositionMargin + i.payments[0].amount), oldPositionOpenNotional, oldPositionLstUpdCPF) ++ transferFee(feeAmount)) ++ upblc((cbalance() + _amount))) | |
568 | 571 | else throw("Strict value is not equal to itself.") | |
569 | 572 | } | |
570 | 573 | } | |
571 | 574 | ||
572 | 575 | ||
573 | 576 | ||
574 | 577 | @Callable(i) | |
575 | 578 | func removeMargin (_amount) = if (if ((0 >= _amount)) | |
576 | 579 | then true | |
577 | 580 | else !(requireOpenPosition(toString(i.caller)))) | |
578 | 581 | then throw("Invalid removeMargin parameters") | |
579 | 582 | else { | |
580 | - | let $ | |
581 | - | let oldPositionSize = $ | |
582 | - | let oldPositionMargin = $ | |
583 | - | let oldPositionOpenNotional = $ | |
584 | - | let oldPositionLstUpdCPF = $ | |
583 | + | let $t02250522657 = getPosition(toString(i.caller)) | |
584 | + | let oldPositionSize = $t02250522657._1 | |
585 | + | let oldPositionMargin = $t02250522657._2 | |
586 | + | let oldPositionOpenNotional = $t02250522657._3 | |
587 | + | let oldPositionLstUpdCPF = $t02250522657._4 | |
585 | 588 | let marginDelta = -(_amount) | |
586 | - | let $ | |
587 | - | let remainMargin = $ | |
588 | - | let badDebt = $ | |
589 | - | let x1 = $ | |
590 | - | let latestCPF1 = $ | |
589 | + | let $t02269422889 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, marginDelta) | |
590 | + | let remainMargin = $t02269422889._1 | |
591 | + | let badDebt = $t02269422889._2 | |
592 | + | let x1 = $t02269422889._3 | |
593 | + | let latestCPF1 = $t02269422889._4 | |
591 | 594 | if ((badDebt != 0)) | |
592 | 595 | then throw("Invalid added margin amount") | |
593 | 596 | else { | |
594 | 597 | let unstake = invoke(USDN_STAKING, "unlockNeutrino", [_amount, toBase58String(USDN)], nil) | |
595 | 598 | if ((unstake == unstake)) | |
596 | 599 | then ((updatePosition(toString(i.caller), oldPositionSize, remainMargin, oldPositionOpenNotional, latestCPF1) ++ withdraw(i.caller, _amount)) ++ upblc((cbalance() - _amount))) | |
597 | 600 | else throw("Strict value is not equal to itself.") | |
598 | 601 | } | |
599 | 602 | } | |
600 | 603 | ||
601 | 604 | ||
602 | 605 | ||
603 | 606 | @Callable(i) | |
604 | 607 | func closePosition () = if (!(requireOpenPosition(toString(i.caller)))) | |
605 | 608 | then throw("Invalid closePosition parameters") | |
606 | 609 | else { | |
607 | - | let $ | |
608 | - | let x1 = $ | |
609 | - | let badDebt = $ | |
610 | - | let realizedPnl = $ | |
611 | - | let marginToVault = $ | |
612 | - | let quoteAssetReserveAfter = $ | |
613 | - | let bsAstRAfter = $ | |
614 | - | let baseAsstFndDeltAfter = $ | |
615 | - | let totalPositionSizeAfter = $ | |
616 | - | let cumulativeNotionalAfter = $ | |
617 | - | let openInteresetNotionalAfter = $ | |
610 | + | let $t02353923871 = internalClosePosition(toString(i.caller)) | |
611 | + | let x1 = $t02353923871._1 | |
612 | + | let badDebt = $t02353923871._2 | |
613 | + | let realizedPnl = $t02353923871._3 | |
614 | + | let marginToVault = $t02353923871._4 | |
615 | + | let quoteAssetReserveAfter = $t02353923871._5 | |
616 | + | let bsAstRAfter = $t02353923871._6 | |
617 | + | let baseAsstFndDeltAfter = $t02353923871._7 | |
618 | + | let totalPositionSizeAfter = $t02353923871._8 | |
619 | + | let cumulativeNotionalAfter = $t02353923871._9 | |
620 | + | let openInteresetNotionalAfter = $t02353923871._10 | |
618 | 621 | if ((badDebt > 0)) | |
619 | 622 | then throw("Unable to close position with bad debt") | |
620 | 623 | else { | |
621 | 624 | let withdrawAmount = abs(marginToVault) | |
622 | 625 | let bd = (cbalance() - withdrawAmount) | |
623 | - | let $ | |
626 | + | let $t02406424160 = if ((0 > bd)) | |
624 | 627 | then $Tuple2(0, abs(bd)) | |
625 | 628 | else $Tuple2(bd, 0) | |
626 | - | let nb = $ | |
627 | - | let fromi = $ | |
629 | + | let nb = $t02406424160._1 | |
630 | + | let fromi = $t02406424160._2 | |
628 | 631 | let x = if ((fromi > 0)) | |
629 | 632 | then { | |
630 | 633 | let withdrawInsurance = invoke(INSURANCE_ADDRESS, "withdraw", [fromi], nil) | |
631 | 634 | if ((withdrawInsurance == withdrawInsurance)) | |
632 | 635 | then nil | |
633 | 636 | else throw("Strict value is not equal to itself.") | |
634 | 637 | } | |
635 | 638 | else nil | |
636 | 639 | if ((x == x)) | |
637 | 640 | then { | |
638 | 641 | let unstake = invoke(USDN_STAKING, "unlockNeutrino", [(withdrawAmount - fromi), toBase58String(USDN)], nil) | |
639 | 642 | if ((unstake == unstake)) | |
640 | 643 | then (((deletePosition(toString(i.caller)) ++ updateAmm(quoteAssetReserveAfter, bsAstRAfter, baseAsstFndDeltAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInteresetNotionalAfter)) ++ withdraw(i.caller, withdrawAmount)) ++ upblc(nb)) | |
641 | 644 | else throw("Strict value is not equal to itself.") | |
642 | 645 | } | |
643 | 646 | else throw("Strict value is not equal to itself.") | |
644 | 647 | } | |
645 | 648 | } | |
646 | 649 | ||
647 | 650 | ||
648 | 651 | ||
649 | 652 | @Callable(i) | |
650 | 653 | func liquidate (_trader) = if (if (!(requireMoreMarginRatio(getMarginRatio(_trader), mmr(), false))) | |
651 | 654 | then true | |
652 | 655 | else !(initialized())) | |
653 | 656 | then throw("Unable to liquidate") | |
654 | 657 | else { | |
655 | - | let $ | |
656 | - | let x1 = $ | |
657 | - | let badDebt = $ | |
658 | - | let x2 = $ | |
659 | - | let marginToVault = $ | |
660 | - | let quoteAssetReserveAfter = $ | |
661 | - | let bsAstRAfter = $ | |
662 | - | let baseAsstFndDeltAfter = $ | |
663 | - | let totalPositionSizeAfter = $ | |
664 | - | let cumulativeNotionalAfter = $ | |
665 | - | let openInteresetNotionalAfter = $ | |
666 | - | let exchangedQuoteAssetAmount = $ | |
658 | + | let $t02509825402 = internalClosePosition(_trader) | |
659 | + | let x1 = $t02509825402._1 | |
660 | + | let badDebt = $t02509825402._2 | |
661 | + | let x2 = $t02509825402._3 | |
662 | + | let marginToVault = $t02509825402._4 | |
663 | + | let quoteAssetReserveAfter = $t02509825402._5 | |
664 | + | let bsAstRAfter = $t02509825402._6 | |
665 | + | let baseAsstFndDeltAfter = $t02509825402._7 | |
666 | + | let totalPositionSizeAfter = $t02509825402._8 | |
667 | + | let cumulativeNotionalAfter = $t02509825402._9 | |
668 | + | let openInteresetNotionalAfter = $t02509825402._10 | |
669 | + | let exchangedQuoteAssetAmount = $t02509825402._11 | |
667 | 670 | let feeToLiquidator = (muld(exchangedQuoteAssetAmount, liquidationFeeRatio()) / 2) | |
668 | - | let $ | |
671 | + | let $t02549225896 = if ((feeToLiquidator > marginToVault)) | |
669 | 672 | then $Tuple3((feeToLiquidator - marginToVault), marginToVault, ((badDebt + feeToLiquidator) - marginToVault)) | |
670 | 673 | else $Tuple3(0, (marginToVault - feeToLiquidator), badDebt) | |
671 | - | let liquidationBadDebt = $ | |
672 | - | let remainMargin = $ | |
673 | - | let totalBadDebt = $ | |
674 | + | let liquidationBadDebt = $t02549225896._1 | |
675 | + | let remainMargin = $t02549225896._2 | |
676 | + | let totalBadDebt = $t02549225896._3 | |
674 | 677 | let bd = (cbalance() - feeToLiquidator) | |
675 | - | let $ | |
678 | + | let $t02594426032 = if ((0 > bd)) | |
676 | 679 | then $Tuple2(0, abs(bd)) | |
677 | 680 | else $Tuple2(bd, 0) | |
678 | - | let nb = $ | |
679 | - | let fromi = $ | |
681 | + | let nb = $t02594426032._1 | |
682 | + | let fromi = $t02594426032._2 | |
680 | 683 | let x = if ((fromi > 0)) | |
681 | 684 | then { | |
682 | 685 | let withdrawInsurance = invoke(INSURANCE_ADDRESS, "withdraw", [fromi], nil) | |
683 | 686 | if ((withdrawInsurance == withdrawInsurance)) | |
684 | 687 | then nil | |
685 | 688 | else throw("Strict value is not equal to itself.") | |
686 | 689 | } | |
687 | 690 | else nil | |
688 | 691 | if ((x == x)) | |
689 | 692 | then { | |
690 | 693 | let unstake = invoke(USDN_STAKING, "unlockNeutrino", [(feeToLiquidator - fromi), toBase58String(USDN)], nil) | |
691 | 694 | if ((unstake == unstake)) | |
692 | 695 | then (((deletePosition(_trader) ++ updateAmm(quoteAssetReserveAfter, bsAstRAfter, baseAsstFndDeltAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInteresetNotionalAfter)) ++ withdraw(i.caller, feeToLiquidator)) ++ upblc(nb)) | |
693 | 696 | else throw("Strict value is not equal to itself.") | |
694 | 697 | } | |
695 | 698 | else throw("Strict value is not equal to itself.") | |
696 | 699 | } | |
697 | 700 | ||
698 | 701 | ||
699 | 702 | ||
700 | 703 | @Callable(i) | |
701 | 704 | func payFunding () = { | |
702 | 705 | let fundingBlockTimestamp = nextFundingBlockTimestamp() | |
703 | 706 | if (if ((fundingBlockTimestamp > lastBlock.timestamp)) | |
704 | 707 | then true | |
705 | 708 | else !(initialized())) | |
706 | 709 | then throw(((("Invalid funding block timestamp: " + toString(lastBlock.timestamp)) + " < ") + toString(fundingBlockTimestamp))) | |
707 | 710 | else { | |
708 | 711 | let underlyingPrice = getOracleTwapPrice() | |
709 | 712 | let spotTwapPrice = getTwapSpotPrice() | |
710 | 713 | let premium = (spotTwapPrice - underlyingPrice) | |
711 | 714 | let premiumFraction = divd(muld(premium, fundingPeriodDecimal()), ONE_DAY) | |
712 | 715 | let totalTraderPositionSize = totalPositionSize() | |
713 | 716 | let ammFundingPaymentProfit = muld(premiumFraction, totalTraderPositionSize) | |
714 | 717 | let fundingAmount = abs(ammFundingPaymentProfit) | |
715 | - | if ((0 > ammFundingPaymentProfit)) | |
718 | + | let balanceChange = if ((0 > ammFundingPaymentProfit)) | |
716 | 719 | then { | |
717 | 720 | let withdrawInsurance = invoke(INSURANCE_ADDRESS, "withdraw", [fundingAmount], nil) | |
718 | 721 | if ((withdrawInsurance == withdrawInsurance)) | |
719 | 722 | then { | |
720 | 723 | let stake = invoke(USDN_STAKING, "lockNeutrino", nil, [AttachedPayment(USDN, fundingAmount)]) | |
721 | 724 | if ((stake == stake)) | |
722 | 725 | then upblc((cbalance() + fundingAmount)) | |
723 | 726 | else throw("Strict value is not equal to itself.") | |
724 | 727 | } | |
725 | 728 | else throw("Strict value is not equal to itself.") | |
726 | 729 | } | |
727 | - | else ({ | |
728 | - | let unstake = invoke(USDN_STAKING, "unlockNeutrino", [fundingAmount, toBase58String(USDN)], nil) | |
729 | - | if ((unstake == unstake)) | |
730 | - | then { | |
731 | - | let depositInsurance = invoke(INSURANCE_ADDRESS, "deposit", nil, [AttachedPayment(USDN, fundingAmount)]) | |
732 | - | if ((depositInsurance == depositInsurance)) | |
733 | - | then upblc((cbalance() - fundingAmount)) | |
734 | - | else throw("Strict value is not equal to itself.") | |
735 | - | } | |
736 | - | else throw("Strict value is not equal to itself.") | |
737 | - | } ++ updateFunding(0, (fundingBlockTimestamp + fundingPeriodSeconds()), (latestCPF() + premiumFraction), divd(premiumFraction, underlyingPrice))) | |
730 | + | else if ((ammFundingPaymentProfit != 0)) | |
731 | + | then { | |
732 | + | let unstake = invoke(USDN_STAKING, "unlockNeutrino", [fundingAmount, toBase58String(USDN)], nil) | |
733 | + | if ((unstake == unstake)) | |
734 | + | then { | |
735 | + | let depositInsurance = invoke(INSURANCE_ADDRESS, "deposit", nil, [AttachedPayment(USDN, fundingAmount)]) | |
736 | + | if ((depositInsurance == depositInsurance)) | |
737 | + | then upblc((cbalance() - fundingAmount)) | |
738 | + | else throw("Strict value is not equal to itself.") | |
739 | + | } | |
740 | + | else throw("Strict value is not equal to itself.") | |
741 | + | } | |
742 | + | else upblc((cbalance() - fundingAmount)) | |
743 | + | (balanceChange ++ updateFunding(0, (fundingBlockTimestamp + fundingPeriodSeconds()), (latestCPF() + premiumFraction), divd(premiumFraction, underlyingPrice))) | |
738 | 744 | } | |
739 | 745 | } | |
740 | 746 | ||
741 | 747 | ||
742 | 748 | ||
743 | 749 | @Callable(i) | |
744 | - | func v_close (_trader) = { | |
745 | - | let $t02821428292 = internalClosePosition(_trader) | |
746 | - | let x1 = $t02821428292._1 | |
747 | - | let x2 = $t02821428292._2 | |
748 | - | let x3 = $t02821428292._3 | |
749 | - | let x4 = $t02821428292._4 | |
750 | - | let x5 = $t02821428292._5 | |
751 | - | let x6 = $t02821428292._6 | |
752 | - | let x7 = $t02821428292._7 | |
753 | - | let x8 = $t02821428292._8 | |
754 | - | let x9 = $t02821428292._9 | |
755 | - | let x10 = $t02821428292._10 | |
756 | - | throw(((s(x2) + s(x3)) + s(x4))) | |
750 | + | func v_get (_trader) = { | |
751 | + | let $t02861928672 = internalClosePosition(_trader) | |
752 | + | let x1 = $t02861928672._1 | |
753 | + | let x2 = $t02861928672._2 | |
754 | + | let x3 = $t02861928672._3 | |
755 | + | let x4 = $t02861928672._4 | |
756 | + | throw((((s(x2) + s(x3)) + s(x4)) + s(getMarginRatio(_trader)))) | |
757 | + | } | |
758 | + | ||
759 | + | ||
760 | + | ||
761 | + | @Callable(i) | |
762 | + | func v_get2 (_trader) = { | |
763 | + | let $t02878528838 = internalClosePosition(_trader) | |
764 | + | let x1 = $t02878528838._1 | |
765 | + | let x2 = $t02878528838._2 | |
766 | + | let x3 = $t02878528838._3 | |
767 | + | let x4 = $t02878528838._4 | |
768 | + | throw((((s(x2) + s(x3)) + s(x4)) + s(getMarginRatio(_trader)))) | |
757 | 769 | } | |
758 | 770 | ||
759 | 771 | ||
760 | 772 | @Verifier(tx) | |
761 | 773 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], ADMIN_PUBLIC_KEY) | |
762 | 774 |
github/deemru/w8io/169f3d6 142.19 ms ◑