Skip to content
NAVIDocs
Open app
Skip to Content

Integrate a lending vault

Identify a vault, discover its markets and reward objects, and construct deposit and withdrawal transactions.

1. Overview

A NAVI Vault accepts deposits of a single asset, issues proportional shares, and deploys the assets across one or more NAVI lending markets. Yield accrues to share value. Allocation across markets is performed by a designated allocator; strategy parameters are set by a curator, subject to a timelock on sensitive changes.

The contract is snapshot-accounted: a market position's value is a cached figure refreshed only by an explicit call. Value-changing operations assert that the cache was refreshed within the same programmable transaction block. Section 3 specifies this requirement, which governs the structure of every deposit, withdrawal and pricing query.

1.1 Object model

ObjectOwnershipPurpose
Vault<CoinType>sharedOne instance per underlying asset. Holds the idle balance, market positions, share ledger and reward state.
Receiptowned (key + store)A depositor's position. Transferable; transferring the object transfers the position.
Timelocks<CoinType>sharedPending governance proposals for one vault.
Allocators, CuratorssharedCapability registries.

Shares are not represented as a coin. They are recorded in Vault.user_states, a table keyed by the Receipt object address. There is no share token, no Balance<Share> and no treasury capability; the unit of ownership is the Receipt object. A single account may hold multiple Receipts against one vault, each an independent position that never merges with the others.

Locating a holder's positions. Receipt is not generic. A single type — <original_package>::navi_vault::Receipt, with no type parameter — covers every vault on the deployment. Therefore:

  • List the account's owned objects filtered by that exact type. Filtering by Receipt<CoinType> matches nothing, because no such type exists.
  • Read each Receipt's vault_address field and compare it against the vault of interest. This is the only way to attribute a Receipt to a vault, and it is mandatory rather than an optimisation when several vaults share a CoinType (§1.3): the Receipt type is identical across all of them.
  • Use the original package identifier in the type filter, never the latest (§1.3).
Vault<CoinType>
├── idle_balance : Balance<CoinType>          assets held in the vault, not deployed
├── markets      : VecMap<address, MarketInfo>
│                     └── current_balance     cached position in one NAVI market (see §3)
├── user_states  : Table<address, UserState>  keyed by Receipt object address
└── total_shares : u64                        includes accrued, unclaimed fee shares

Total assets under management are defined as:

total_assets = idle_balance + Σ markets[i].current_balance

1.2 Accounting units and scaling

All CoinType amounts in the public interface — deposit.amount, withdraw.amount, MarketInfo.current_balance, get_total_assets, convert_to_assets, convert_to_shares — are expressed in the token's native decimals (9 for SUI, 6 for USDC). sync_market_balance performs the conversion from NAVI's internal 9-decimal representation.

The single exception is MarketInfo.loss, and the loss argument of set_loss, which use NAVI's internal 9-decimal representation irrespective of the token's native decimals. One unit of a 6-decimal token corresponds to 1_000_000_000, not 1_000_000.

QuantityScale
management_fee, _performance_fee, MarketInfo.penaltyWAD — 1e18 = 100%
VaultRewardRule.vault_reward_index, reward_rateRAY — 1e27. reward_rate is per millisecond
last_sync_at, last_harvest_atmilliseconds
last_update_timestamp, proposal timestampsseconds

The mixed timestamp units are a property of the contract, not a documentation artefact: freshness assertions compare against clock.timestamp_ms(), while fee accrual and timelocks operate in seconds.

1.3 Identifiers

Mainnet values, verified on chain 2026-08-05. Hold them as configuration; do not compile them into a client.

Package

An upgrade publishes a new package but leaves type identity on the original. Both are required, and they are not interchangeable.

IdentifierUse for
Call target0x13e1e0ddcf3a76cde006d530e98a0f985c446013cfedeae6dd067a2f1ea88ff5The target of every moveCall
Type identity0x51cecaacaed0bd436f04ebbd8ba0ca1627c9c4d0e54ad28eff095ca78591518cEvery type string: owned-object filters, MoveEventType filters, objectType matching

The call target changes on every upgrade; the type identity never changes. Both wrong-way errors are silent. Calling a superseded package runs superseded code until the vault's dependencies move underneath it, then aborts 1400 (§3.4). Filtering types by the call target returns zero results with no error.

Shared objects

ObjectIdentifier
Clock0x6
SuiSystemState0x5
PriceOracle0x1568865ed9a0b5ec414220e8f79b3d04c77acc82358f6e5ae4635687392ffbef
IncentiveV20xf87a8acb8b81d14307894d12595541a73f19933f88e1326d5be349c7a6f7559c

Vaults

VaultVault objectTimelocks object
SUI High Yield0x864527a8ed2435aed828b46c6d9d0244506b418761cca25b7dd47a83c7797a290x04523a8d1f1a3019f9b8f5e61984544d5dfc467ec0e91d64f228a17e30737264
SUI Prime0x01236ff6c66c0c668950f9702629b42f372bf478793d055d2a7eca15e0b0d1e70x3f1533e62792cb686b3dd794d408a83a653a1f3b553224c70c7dfcc8b290dcf4
USDC High Yield0x54359eb5d0e4364bd26989899fdb472f5594d1885e1f0d816ef4a066cab2ae4c0x80696a1a627f9e02059c9dfed0e94ef7905424bc602ff85d3ad9fc47638887a6
USDC Prime0x908c978d1a007aec4bcdc8233a0273de27ab059b9e6611bdad083457abb7f0620x0aaebd50fbc34041706d2e153fbfe31b475f38e6055bb788340aa9eecba45364
CoinTypeDecimalsVaults
0x2::sui::SUI9SUI High Yield, SUI Prime
0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC6USDC High Yield, USDC Prime

Timelocks is required only to read pending governance proposals, not for depositor operations.

Two vaults share each CoinType, so their Vault<CoinType> type strings are identical and the type does not identify the vault. A vault is identified by its object ID alone; see §1.1 on attributing a holder's positions. Newly created vaults are discoverable from CreateVaultEvent (§10.8).

Oracle

Required by withdraw and deallocate only (§3.3).

ItemIdentifier
Package0x4837ae94425107554c8847721cf9954c1ad8e10520433b9e37dc11c507148bea
Entrypointoracle_pro::update_single_price_v3
OracleConfig0x1afe1cb83634f581606cc73c4487ddd8cc39a944b951283af23f7d69d5589478
Supra OracleHolder0xaa0315f0748c1f24ddb2b45f7939cff40f7a8104af5ccbc4a1d32f870c0b4105
Switchboard Aggregator0x1fa7566f40f93cdbafd5a029a231e06664219444debb59beec2fe3f19ca08b7e

Per asset:

AssetPyth Pro PriceInfoObjectNAVI price feed
SUI0x89b2add829cb6fcd017153fff428bc9faec4d06d643ecfc435af5b55a9e987f00x2cab9b151ca1721624b09b421cc57d0bb26a1feb5da1f821492204b098ec35c9
USDC0x6ddfc6f9921e55998cbc2e68f78eba897981d79ac17f66c5277bc38954a2a3f80xe120611435395f144b4bcc4466a00b6b26d7a27318f96e148648852a9dd6b31c

Argument order of oracle_pro::update_single_price_v3:

(&Clock, &mut OracleConfig, &mut PriceOracle, &Supra OracleHolder,
 &Pyth Pro PriceInfoObject, &Switchboard Aggregator, NAVI feed address)

The NAVI price feed is a pure address argument, not an object reference; the remaining six are objects. PriceOracle is taken by mutable reference here and by immutable reference by withdraw — passing the same shared object both ways within one block is correct.

The entrypoint revision advances when an upstream price provider is upgraded, and successive revisions accept different PriceInfoObject types. Resolve it from the oracle package the deployment currently links against rather than pinning the name.

Reward funds

Required for collect_reward, one per reward coin type (§4.3). A vault with no reward rules needs none.

Reward coinRewardFund object
0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT0x7093cf7549d5e5b35bfde2177223d1050f71655c7f676a5e610ee70eb4d93b5c

Read from the vault, never configured

Per-market Pool, Storage, IncentiveV3, IncentiveV2 and asset_id, together with caps, penalties, fee rates, paused, version and reward-rule indices, are held in vault state and must be read at transaction-construction time (§4.1, §4.2). A curator can add a market or change these values at any time; hardcoding them produces the failures in §3.2.

4. Object discovery

Every object required by a transaction is derivable from vault state, with the single exception of RewardFund objects, which reside on the NAVI lending side.

4.1 Markets

public fun num_markets<CoinType>(&Vault<CoinType>): u64
public fun get_market_address_at_index<CoinType>(&Vault<CoinType>, idx: u64): address
public fun get_market_config<CoinType>(&Vault<CoinType>, pool_address: address)
    : (u64, u64, u64, u8, u64, address, u8, address, address)

Iterating 0 .. num_markets yields each pool address; get_market_config then returns the Storage, IncentiveV2 and IncentiveV3 object identifiers registered for that market, together with its cap, penalty and status. The contract validates the objects passed to it against these recorded addresses and aborts with E_MARKET_CONFIG_MISMATCH (10017) on any divergence.

Return positions are specified in §10.5. status is 0 for Active and 1 for Disabled.

4.2 Reward rules

public fun num_reward_rules<CoinType>(&Vault<CoinType>): u64
public fun get_rule_info<CoinType>(&Vault<CoinType>, idx: u64)
    : (address, String, address, u256, u64, bool, u256, bool, u64, u64)

Each rule with is_active && !is_vault_native requires one collect_reward call, parameterized with:

  • type arguments <CoinType, RewardCoinType>, where RewardCoinType is the rule's stored reward_coin_type. A mismatch aborts with E_REWARD_COIN_TYPE_MISMATCH (10029);
  • the Storage and IncentiveV3 objects of the market identified by navi_pool_id;
  • the corresponding RewardFund<RewardCoinType> object;
  • the rule's index.

reward_rules is append-only. Disabling a rule clears is_active but does not remove the entry, so indices are stable for the lifetime of the vault.

A vault may legitimately have no reward rules at all, in which case no collect_reward call is required in any block and claim_reward returns a zero-valued coin. Do not treat an empty rule set as a discovery failure.

4.3 RewardFund objects

RewardFund<T> is a shared object belonging to NAVI's incentive_v3, one per (reward coin type, market). It is not recorded in vault state and must be resolved from the lending side. Three routes, in order of preference:

  1. NAVI's incentive configuration service, keyed by reward coin type and market. Authoritative and the intended integration path.
  2. RewardFundCreated events emitted by incentive_v3 on fund creation. Each carries the coin type and market identifier; incentive_v3::get_fund_market_id and verify_market_incentive_funds allow the mapping to be checked on chain.
  3. A prior collect_reward transaction for the same rule. The fund is argument 4 of collect_reward (§10.4). Querying the vault's transaction history for calls to navi_vault::collect_reward and reading argument 4 recovers the fund object for each rule without any off-chain dependency. This is the most direct route when bootstrapping against an existing vault.

Fund objects are stable and may be cached; the currently required one is listed in §1.3. A missing or wrong fund is not silently tolerated: the rule goes unharvested and the subsequent deposit or withdraw aborts with E_REWARDS_NOT_COLLECTED (10007).

4.4 Objects held as configuration

Clock, SuiSystemState, the NAVI PriceOracle, the vault object and the package identifier are not discoverable from vault state and are held as configuration; see §1.3. The PriceOracle is required by withdraw and deallocate only.

5. Transaction construction

Throughout this section, M denotes the number of markets registered on the vault and R the number of active market reward rules.

5.1 Deposit

for each market m in vault.markets:                       # all markets, Active and Disabled
    sync_market_balance<CoinType>(vault, m.storage, m.pool, clock)
for each active market rule r:
    collect_reward<CoinType, r.reward_coin>(vault, clock, r.storage, r.incentive_v3,
                                            r.reward_fund, r.index)
(receipt, shares) = deposit<CoinType>(vault, receipt_opt, clock,
                                      target.storage, target.pool, deposit_coin, amount,
                                      target.incentive_v2, target.incentive_v3, ctx)
transfer receipt → depositor

Total: M + R + 1 Move calls.

receipt_opt: Option<Receipt>. Supply option::none<Receipt>() for a new position, in which case the vault mints and returns a Receipt, or option::some(receipt) to add to an existing position. Constructing the value requires an explicit 0x1::option::none or 0x1::option::some Move call within the block; see Appendix A.

Amount. deposit_coin.value() must equal amount exactly, otherwise the call aborts with E_AMOUNT_MISMATCH (10021). The coin must be split to the exact amount within the transaction.

Target market. Behaviour depends on get_vault_default_market:

  • Default market set (≠ 0x0): the pool, storage, incentive_v2 and incentive_v3 arguments must be those of the default market, and the deposit is forwarded directly into NAVI. Any other pool aborts with E_DEFAULT_MARKET_MISMATCH (10022). The market must be Active (E_MARKET_INVALID, 10010) and the resulting balance must not exceed the market cap (E_CAP_EXCEEDED, 10005).
  • Default market unset (0x0): assets are added to idle_balance. The pool, storage and incentive arguments are neither validated nor used for routing, but remain type-required; supplying a registered market's objects is recommended.

Vault cap. Enforced as total_assets + amount ≤ vault_cap, where 0 denotes no limit. Violation aborts with E_VAULT_CAP_EXCEEDED (10039).

Returned values. The returned Receipt must be consumed by the transaction — transferred to the depositor. The second return value is the number of shares minted.

5.2 Withdrawal

for each market m in vault.markets:
    sync_market_balance<CoinType>(vault, m.storage, m.pool, clock)
for each active market rule r:
    collect_reward<CoinType, r.reward_coin>(...)
(coin, shares_burned) = withdraw<CoinType>(vault, receipt, clock, oracle,
                                           source.storage, source.pool,
                                           amount, max_shares, from_default,
                                           source.incentive_v2, source.incentive_v3,
                                           system_state, ctx)
transfer coin → depositor

Total: M + R + 1 Move calls. receipt is passed by mutable reference and remains with its owner.

Routing. The idle balance is drawn down first; only the shortfall is withdrawn from the market identified by pool. The pool argument therefore designates the source of the shortfall, not of the whole withdrawal. When the idle balance covers the full amount, the pool argument is not validated and no penalty applies.

from_defaultBehaviour
truepool must be the vault's default market, otherwise E_DEFAULT_MARKET_MISMATCH. amount is clamped to the holder's maximum redeemable value, so a sufficiently large value — u64::MAX — requests a full exit. No penalty is applied.
falsepool may be any registered market, Active or Disabled; market status is not checked on withdrawal, so a market being wound down remains drainable. If pool differs from the default market, that market's penalty applies.

Penalty. penalty_shares = ceil(market_portion_shares × penalty / 1e18), bounded by MAX_PENALTY = 30%. It applies only to the portion actually withdrawn from a non-default market; the portion served from the idle balance is unpenalized.

Slippage. max_shares bounds the shares burned. The check is shares_burned ≤ max_shares and is skipped entirely when max_shares == 0; the value 0 denotes "no limit", not "no shares". It must be computed rather than defaulted (§6.1). Violation aborts with E_SLIPPAGE_EXCEEDED (10040).

Returned amount. NAVI may return marginally less than requested from the market leg. Shares are burned against the amount actually received, and the returned coin's value is authoritative. Clients must read the coin value or WithdrawEvent.amount rather than assuming amount.

5.3 Reward claim

for each active market rule r paying RewardCoinType:      # recommended
    collect_reward<CoinType, RewardCoinType>(...)
coin = claim_reward<CoinType, RewardCoinType>(vault, receipt, clock, ctx)
transfer coin → depositor

claim_reward has no freshness preconditions and may be called in isolation, in which case only rewards already harvested into the vault are payable. Vault-native accrual is settled within the call. One call is required per reward coin type; entitlements are aggregated across all rules paying that coin.

The function returns a zero-valued coin rather than aborting when nothing is claimable. The returned object must still be consumed. Clients should query get_user_claimable_reward_amount and omit the call when the result is zero, to avoid creating zero-valued objects in the recipient's account.

5.4 Allocation and deallocation

sync_market_balance<CoinType>(vault, storage, pool, clock)          # target market only
allocate<CoinType>(vault, allocators, cap, clock, storage, pool, amount,
                   incentive_v2, incentive_v3, ctx)

Only the target market requires synchronization; no reward harvest is required. allocate requires the target market to be Active. deallocate operates on Disabled markets as well and additionally requires the PriceOracle and SuiSystemState objects. Both require an AllocatorCap that is registered in the shared Allocators object and bound to the vault.

5.5 Fee claim

for each active market rule r:
    collect_reward<CoinType, r.reward_coin>(...)
claim_management_fee<CoinType>(vault, cap, receipt, clock)

All active market rules must be harvested; market synchronization is not required. Fees become claimable only once accrue_interest has run, which occurs within deposit, withdraw and fee-rate changes. A claim in isolation therefore collects previously accrued fees only.

Fee shares are credited to a Receipt supplied by the caller. The Receipt's reward indices are anchored on first claim; reward index growth that occurred while shares were pending is not recoverable afterwards. Operators should create the Receipt and issue the first claim early, even when the pending amount is zero, and claim frequently thereafter.


5.6 Verified block shapes

The following are the command sequences of executed mainnet transactions, reproduced to fix the ordering and argument positions unambiguously. Argument indices correspond to the signatures in §10.3 and §10.4.

Deposit — a vault with four markets and one active market reward rule:

 0  navi_vault::sync_market_balance<CoinType>    (vault, storage_A, pool_A, clock)
 1  navi_vault::sync_market_balance<CoinType>    (vault, storage_B, pool_B, clock)
 2  navi_vault::sync_market_balance<CoinType>    (vault, storage_C, pool_C, clock)
 3  navi_vault::sync_market_balance<CoinType>    (vault, storage_D, pool_D, clock)
 4  navi_vault::collect_reward<CoinType, RCoin>  (vault, clock, storage, incentive_v3,
                                                  reward_fund, rule_index)
 5  navi_vault::create_receipt<CoinType>         (vault)
 6  SplitCoins
 7  0x1::option::some<Receipt>
 8  navi_vault::deposit<CoinType>
 9  TransferObjects

No oracle call appears, consistent with §3.3. Commands 5 and 7 show the alternative to option::none: mint the Receipt explicitly, then wrap it. Both forms are valid; option::none collapses the two commands into one.

Withdrawal — a vault with two markets and one active market reward rule:

 0  oracle_pro::update_single_price_v3           (clock, oracle_config, price_oracle, supra_oracle_holder,
                                                  pyth_price_info, switchboard_aggregator, feed_address)
 1  navi_vault::sync_market_balance<CoinType>    (vault, storage_A, pool_A, clock)
 2  navi_vault::sync_market_balance<CoinType>    (vault, storage_B, pool_B, clock)
 3  navi_vault::collect_reward<CoinType, RCoin>  (vault, clock, storage, incentive_v3,
                                                  reward_fund, rule_index)
 4  navi_vault::withdraw<CoinType>               (vault, receipt, clock, price_oracle,
                                                  storage, pool, amount, max_shares,
                                                  from_default, incentive_v2, incentive_v3,
                                                  system_state)
 5  TransferObjects

The price update occupies position 0 and passes the same PriceOracle object that withdraw receives at argument 3. system_state is 0x5 and clock is 0x6.

The exact signature and object set of the oracle update belong to the oracle package, not to this interface, and differ between oracle implementations. Resolve them from the oracle package version the target deployment links against.

11. Integration requirements

The following are mandatory for correct integration.

  1. Market and reward-rule lists are read from vault state at transaction-construction time, not cached across transactions (§3.2).
  2. Deposit and withdrawal blocks include sync_market_balance for every registered market, including those in Disabled status (§3.1).
  3. Deposit and withdrawal blocks include collect_reward for every rule with is_active && !is_vault_native (§3.1).
  4. Balances, share prices and quotes are produced from a simulated block that synchronizes before reading (§6.1).
  5. max_shares is computed from a simulated withdrawal and is non-zero (§5.2).
  6. Full exits use from_default = true with a sufficiently large amount, and tolerate a dust remainder (§2, §5.2).
  7. The deposit coin is split to exactly amount (§5.1).
  8. Returned Receipt and Coin values are consumed by the transaction; zero-valued reward coins are merged or destroyed (§5.1, §5.3).
  9. is_paused and version are evaluated before constructing a transaction (§9).
  10. Withdrawal and deallocation blocks begin with an oracle price update, before the market synchronizations (§3.3, §5.6).
  11. Abort 1400 is surfaced as a protocol outage, not a user error, and no synced balance is displayed nor deposit accepted while it persists (§3.4).
  12. Aborts 1502, 1506 and 1604 are distinguished from the vault's own codes and presented as transient or external, not as malformed requests (§3.3, §10.7).
  13. Displayed yields account for fee-share dilution, and displayed withdrawal costs account for the market penalty (§5.2, §7).
  14. Identifiers from §1.3 are supplied as configuration, with an update path for the call-target package across upgrades, and the call target and type identity are not interchanged (§1.3, §9).

On this page