Get admin address.
fn get_admin(env: soroban_sdk::Env) -> Result
Set admin. Admin only.
fn set_admin(
env: soroban_sdk::Env,
new_admin: soroban_sdk::Address,
) -> Result<(), PositionError>
Extend contract TTL. Public.
fn extend_ttl(env: soroban_sdk::Env)
Initialize the contract. Can only be called once.
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
oracle_registry: soroban_sdk::Address,
accounting_token: soroban_sdk::Address,
) -> Result<(), PositionError>
Compute the NAV for an account.
Loops all registered positions, calls each adapter's
get_all_position_values(account, oracle_registry), and sums up
asset vs debt values in USDC (6 decimals, scale = 1_000_000).
fn compute_nav(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
) -> Result
Get the adapter address for a protocol.
fn get_adapter(
env: soroban_sdk::Env,
protocol_id: soroban_sdk::Symbol,
) -> Result
Get a specific position by index.
fn get_position(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
index: u32,
) -> Result
Get all positions for an account.
fn get_positions(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
) -> soroban_sdk::Vec
Remove an adapter. Admin only. Uses swap-with-last for O(1) removal.
fn remove_adapter(
env: soroban_sdk::Env,
protocol_id: soroban_sdk::Symbol,
) -> Result<(), PositionError>
Remove a position by index. Admin only. Uses swap-with-last.
fn remove_position(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
index: u32,
) -> Result<(), PositionError>
Get all registered adapter protocol IDs.
fn get_all_adapters(env: soroban_sdk::Env) -> soroban_sdk::Vec
Register an adapter for a protocol. Admin only.
fn register_adapter(
env: soroban_sdk::Env,
protocol_id: soroban_sdk::Symbol,
adapter: soroban_sdk::Address,
) -> Result<(), PositionError>
Register a position for an account. Admin only.
position_id is protocol-specific (e.g., pool address for Blend).
fn register_position(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
protocol_id: soroban_sdk::Symbol,
position_id: soroban_sdk::Symbol,
) -> Result
Get the number of positions for an account.
fn get_position_count(env: soroban_sdk::Env, account: soroban_sdk::Address) -> u32
Get oracle registry address.
fn get_oracle_registry(
env: soroban_sdk::Env,
) -> Result
Set oracle registry. Admin only.
fn set_oracle_registry(
env: soroban_sdk::Env,
oracle_registry: soroban_sdk::Address,
) -> Result<(), PositionError>
Batch-register multiple token positions for DirectHoldings.
fn register_tokens_batch(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
protocol_id: soroban_sdk::Symbol,
position_ids: soroban_sdk::Vec,
) -> Result