NAVI Protocol Developer Docs
  • đŸ–Ĩī¸Build with NAVI Protocol
  • 📖Smart Contract Overview
    • 1ī¸Lending Core
    • 2ī¸Flash Loan
    • 3ī¸Calculator
    • 4ī¸Dynamic Calculator
    • 5ī¸Storage
  • 🕓Decentralized Oracle
    • đŸ’ŊOracle Interface
  • đŸ—ēī¸Contract Configuration
    • 1ī¸âƒŖGet the Latest Package ID
    • 2ī¸âƒŖGet Pools Config and Oracle Price Feeds
    • 3ī¸âƒŖGet Flashloan Config
  • đŸ›Šī¸NAVI SDK
    • 1ī¸Getting Started
    • 2ī¸Retrieve Info & Data
    • 3ī¸Interactions With NAVI
    • 4ī¸PTB Functions
    • 5ī¸Other Ways to Interact with NAVI
    • 6ī¸Demo
  • 📲NAVI UI SDK
    • ⭐Getting Started
    • đŸ…°ī¸Aggregator Components
  • 🎧Contract Integration with NAVI
    • 1ī¸âƒŖRetrieve Pools Info inside Contract
    • 2ī¸âƒŖIntegration with Account Cap
    • 3ī¸âƒŖDemo
  • 🏅NAVI Aggregator
    • 1ī¸âƒŖGetting Started
    • 2ī¸âƒŖAggregator SDK
    • 3ī¸âƒŖAggregator API
    • 🛜Contact Page
  • NAVI Bridge
    • 🚀Quick Start
    • 📄Bridge SDK
  • 📊NAVI Uptime Status Page
  • 📚NAVI API Collection
    • NAVI API
    • afSui, haSui, vSui API
  • ❓FAQ
Powered by GitBook
On this page
  • Deposit Coin
  • Withdraw Coin
  • Borrow Coin
  • Repay Debt
  • Flashloan
  • Liquidation
  • Claim Single Assert Reward
  • Claim All Reward
  • Claim All Reward and Resupply
  • Update Oracle PTB
  1. NAVI SDK

PTB Functions

The PTB functions are designed to seamlessly integrate with other PTB codebases. These functions can be easily imported and used in various environments outside of the SDK, offering flexibility for broader application in your projects.

Deposit Coin

Deposits a specified coin into the pool.

depositCoin(txb: Transaction, _pool: PoolConfig, coinObject: any, amount: any)

Deposits a coin with account cap restrictions.

depositCoinWithAccountCap(txb: Transaction, _pool: PoolConfig, coinObject: any, accountCapAddress: string)

Withdraw Coin

Note: These PTB functions return a coin object, which needs to be either used or explicitly dropped within the PTB code.

Withdraws a specified amount of coin from the pool.

const [returnedCoin] = withdrawCoin(txb: Transaction, _pool: PoolConfig, amount: number)

Withdraws a coin with account cap restrictions.

const [returnedCoin] = withdrawCoinWithAccountCap(txb: Transaction, _pool: PoolConfig, account: string, withdrawAmount: number, sender: string)

Borrow Coin

Borrows a specified amount of coin from the pool.

const [returnedCoin] = borrowCoin(txb: Transaction, _pool: PoolConfig, borrowAmount: number)

Repay Debt

Repays a specified debt amount using a coin object.

repayDebt(txb: Transaction, _pool: PoolConfig, coinObject: any, repayAmount: n

Flashloan

Initiates a flashloan from the pool with a specified amount.

const [balance, receipt] = flashloan(txb: Transaction, _pool: PoolConfig, amount: number)

Repays the flashloan using the provided receipt and repayment coin.

const [e_balance] = repayFlashLoan(txb: Transaction, _pool: PoolConfig, receipt: any, repayCoin: any)

Liquidation

This function liquidates a position by paying debt and receiving collateral.

const [collateralBalance, remainDebtBalance] = liquidateFunction(txb: Transaction, payCoinType: CoinInfo, payCoinObj: any, collateralCoinType: CoinInfo, to_liquidate_address: string, to_liquidate_amount: string)
  • collateralBalance is collateral coin what liquidator get after paying for the debt.

  • remainDebtBalance is repay coin left after paying for debt.

Claim Single Assert Reward

Claims available rewards by assetId for the specified account.

claimRewardsByAssetIdPTB(    
    client: SuiClient, 
    userToCheck: string, 
    assetId: number, 
    existingTx?: Transaction
)

Claim All Reward

Claims all available rewards for the specified account.

claimAllRewardsPTB(
    client: SuiClient, 
    userToCheck: string, 
    existingTx?: Transaction
)

Claim All Reward and Resupply

Claims all available rewards and resupplies for the specified account. If a reward coin is not included in the pool, it will be transferred to the user's wallet.

claimAllRewardsResupplyPTB(
    client: SuiClient, 
    userToCheck: string, 
    existingTx?: Transaction
)

Update Oracle PTB

updateOraclePTB(client: SuiClient, txb: Transaction)

PreviousInteractions With NAVINextOther Ways to Interact with NAVI

Last updated 2 months ago

A flashloan demo is also provided:

đŸ›Šī¸
4ī¸
Sample TX