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