| name | navi |
| description | This skill should be used when the user asks about Navi Protocol, Navi lending, Navi borrowing, or wants to integrate with Navi on Sui. Covers lending markets, reserves, obligations, price feeds, and reward distribution. |
Navi Protocol Skill
Navi Protocol is a lending/borrowing protocol on the Sui blockchain. It allows users to deposit assets as collateral, borrow against them, repay loans, and perform liquidations. It includes flash loan support and a multi-version incentive/reward system.
Package Addresses
| Package | Original Package ID | Latest On-chain ID |
|---|
| Lending Core | 0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca | 0x81c408448d0d57b3e371ea94de1d40bf852784d3e225de1e74acab3e8395c18f |
| Oracle (Navi) | 0xca441b44943c16be0e6e23c5a955bb971537ea3289ae8016fbf33fffe1fd210f | 0xc2d49bf5e75d2258ee5563efa527feb6155de7ac6f6bf025a23ee88cd12d5a83 |
Always reference the original package ID when constructing Move calls, since that is what the module paths use in code.
Source Files
Decompiled modules for the Lending Core package are at:
/Users/eieiron/dev/oss/sui-packages/packages/mainnet_most_used/0x81/c408448d0d57b3e371ea94de1d40bf852784d3e225de1e74acab3e8395c18f/decompiled_modules/
Decompiled modules for the Oracle package are at:
/Users/eieiron/dev/oss/sui-packages/packages/mainnet_most_used/0xc2/d49bf5e75d2258ee5563efa527feb6155de7ac6f6bf025a23ee88cd12d5a83/decompiled_modules/
Architecture Overview
Core Modules (Lending Core package)
lending -- Top-level entry points for deposit, withdraw, borrow, repay, liquidation, and flash loans. Most user-facing operations go through this module or incentive_v3.
storage -- Central state: holds Storage (shared object) with all ReserveData, user info (collaterals, loans), rate factors, and liquidation parameters. Keyed by u8 reserve ID.
pool -- Per-asset Pool<T> (shared objects) that hold actual token balances. Handles decimal normalization (9 decimals internally).
logic -- Business logic: executes deposit/withdraw/borrow/repay/liquidate with health factor checks. Contains user_health_factor, is_health, collateral/loan value calculations.
calculator -- Interest rate math: utilization, borrow rate (kinked model), supply rate, compounded/linear interest. Also value/amount conversion via oracle prices.
flash_loan -- Flash loan support with Config, Receipt<T>, fee split between supplier and treasury.
incentive_v2 -- Reward distribution system (phased incentive pools per asset/option type). Used alongside incentive_v3.
incentive_v3 -- Latest reward system with rule-based rewards per asset pool, borrow fee collection, and claimable reward queries.
account -- AccountCap for programmatic (non-EOA) interactions. Used by composing protocols.
manage -- Admin functions for creating flash loan configs, incentive pools, rules, and managing reward rates.
constants -- Protocol constants: option types (supply=1, withdraw=2, borrow=3, repay=4), flash loan multiple (10000), seconds per year, percentage benchmark (10000).
ray_math -- Ray math (27-decimal fixed point) for precise interest calculations.
validation -- Validates deposit/withdraw/borrow/repay/liquidate operations against caps and ceilings.
version -- Version checking for upgrade safety.
Oracle Package
oracle -- PriceOracle shared object, get_token_price(clock, oracle, token_id) returns (bool, u256, u8) -- (valid, price, decimals).
- Adaptor modules for Pyth and Supra price feeds.
Key Data Types
Storage (shared) -- reserves table, user_info table, paused flag, version.
ReserveData -- per-asset: oracle_id, supply/borrow indices, rate factors, LTV, liquidation factors, treasury.
Pool<T> (shared, per-asset) -- token balance, treasury balance, decimal.
AccountCap -- ownership token for programmatic access.
flash_loan::Config (shared) -- flash loan asset configs.
flash_loan::Receipt<T> -- hot-potato receipt for flash loan repayment.
incentive_v2::Incentive (shared) -- v2 reward pools.
incentive_v3::Incentive (shared) -- v3 rule-based rewards.
incentive_v3::RewardFund<T> (shared) -- holds reward token balances.
Reserve IDs
Reserves are identified by u8 IDs (0, 1, 2, ...). The mapping from reserve ID to coin type is stored in ReserveData.coin_type. Use storage::get_coin_type(storage, reserve_id) to look up which asset a reserve ID corresponds to.
Common Integration Patterns
Deposit (via incentive_v3 -- recommended)
incentive_v3::entry_deposit<CoinType>(clock, storage, pool, asset_id, coin, amount, incentive_v2, incentive_v3, ctx)
Withdraw
incentive_v3::entry_withdraw<CoinType>(clock, oracle, storage, pool, asset_id, amount, incentive_v2, incentive_v3, ctx)
Borrow
incentive_v3::entry_borrow<CoinType>(clock, oracle, storage, pool, asset_id, amount, incentive_v2, incentive_v3, ctx)
Repay
incentive_v3::entry_repay<CoinType>(clock, oracle, storage, pool, asset_id, coin, amount, incentive_v2, incentive_v3, ctx)
Liquidation
incentive_v3::entry_liquidation<DebtCoin, CollateralCoin>(clock, oracle, storage, debt_asset_id, debt_pool, debt_coin, collateral_asset_id, collateral_pool, user_to_liquidate, amount, incentive_v2, incentive_v3, ctx)
Flash Loan
let (balance, receipt) = lending::flash_loan_with_ctx<T>(flash_config, pool, amount, ctx);
// ... use balance ...
let remaining = lending::flash_repay_with_ctx<T>(clock, storage, pool, receipt, repay_balance, ctx);
Claim Rewards (v3)
incentive_v3::claim_reward_entry<RewardCoinType>(clock, incentive_v3, storage, reward_fund, asset_coin_types, rule_ids, ctx)
Programmatic Access with AccountCap
All main operations have *_with_account_cap variants that accept an AccountCap instead of using tx_context::sender. Create one via lending::create_account(ctx).
Important Notes
- All amounts are internally normalized to 9 decimals via
pool::normal_amount / pool::unnormal_amount.
- Interest uses ray math (1e27 precision).
ray_math::ray() = 1e27.
- Health factor >= 1 ray means healthy. Positions with health factor < 1 ray can be liquidated.
- The protocol uses a kinked interest rate model: below optimal utilization uses base_rate + utilization * multiplier; above uses an additional jump_rate_multiplier.
incentive_v3 entry functions are the recommended way to interact, as they handle both v2 and v3 reward state updates.
- The
PriceOracle shared object from the oracle package is required for borrow, withdraw, repay, and liquidation operations.