1.0.16 • Published 9 months ago

iloop-sdk v1.0.16

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

#iloop-sdk

Calculate adjust leverage

  • Deposit: A token JITOSOL
  • Current leverage: X
  • New leverage: Y

-> New Deposit amount: A * Y/X = B

-> Total withdraw collateral: A - B = C

-> if C > 0 -> decrease leverage -> flashBorrow SOL, repay flashBorrowSOL, withdraw collateral, swap collateral to SOL, flash repay SOL

if C < 0 - increase leverage -> flash borrow SOL, swap into JitoSOL, deposit JitoSOL to reserve, borrow SOL from reserve, flash repay SOL

Calculate withdraw collateral

  • total deposit A token JitoSOL
  • Current leverage X
  • withdraw B token

-> Actual withdraw from Reserve: B * X

-> Swap amount = B * X - B = C

-> flash borrow SOL from reserve, repay flash borrow amount to reserve, withdraw JITOSOL, swap JITOSOL to SOL, flash repay SOL

Close multiply position

  • Borrow A SOL
  • Total deposit B SOL

-> flash borrow A SOL, repay A SOL, withdraw B JitoSOL, swap Y JitoSOL to A SOL, repay A SOL

1.0.16

9 months ago

1.0.15

10 months ago

1.0.14

10 months ago

1.0.13

10 months ago

1.0.12

10 months ago

1.0.11

10 months ago

1.0.10

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago