1.0.16 • Published 8 months ago

iloop-sdk v1.0.16

Weekly downloads
-
License
MIT
Repository
-
Last release
8 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

8 months ago

1.0.15

8 months ago

1.0.14

8 months ago

1.0.13

8 months ago

1.0.12

8 months ago

1.0.11

9 months ago

1.0.10

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago