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
  1. Contract Integration with NAVI

Integration with Account Cap

If an external contract wants to interact with the NAVI protocol, an account cap is required for the interaction. The account cap must be stored within the contract as a wrapped object. When calling functions—such as the supply token function—the account cap object must be passed as a parameter to enable the transaction.

Code Snippet: Account Cap Integration

public struct Vault has key, store {
    id: UID,
    account_cap: AccountCap,
    sui_index: u8,
    usdc_index: u8
}

lending_core::incentive_v2::deposit_with_account_cap(
    clock, 
    storage, 
    pool_a, 
    vault.sui_index, 
    deposit_coin, 
    inc_v1, 
    inc_v2, 
    &vault.account_cap
)

In this example, the Vault struct includes an account_cap field that is passed into the deposit_with_account_cap function to enable token deposits.

PreviousRetrieve Pools Info inside ContractNextDemo

Last updated 7 months ago

🎧
2️⃣