Summary
Position holders cannot currently see how much funding they owe or are owed without simulating a position update. Add a read-only view that returns the pending funding amount for a given position.
Proposed API
// reader contract
pub fn get_claimable_funding_amount(
env: Env,
data_store: Address,
oracle: Address,
position_key: Bytes,
) -> FundingAmountResult
pub struct FundingAmountResult {
pub long_token_amount: i128, // positive = owed to holder, negative = holder owes
pub short_token_amount: i128,
pub at_ledger: u64,
}
Acceptance Criteria
Affected Contracts
reader, position_utils
Summary
Position holders cannot currently see how much funding they owe or are owed without simulating a position update. Add a read-only view that returns the pending funding amount for a given position.
Proposed API
Acceptance Criteria
funding_amount_per_sizeminus position's last-settled indexAffected Contracts
reader,position_utils