Skip to content

anchor free margin checks#18

Merged
jordy25519 merged 14 commits intomasterfrom
jordy/margin
Oct 21, 2025
Merged

anchor free margin checks#18
jordy25519 merged 14 commits intomasterfrom
jordy/margin

Conversation

@jordy25519
Copy link
Collaborator

@jordy25519 jordy25519 commented Oct 21, 2025

Adds

export two new functions for margin calculations without the anchor account maps and other unnecessary program validation.

the incremental variant allows recalculating margin in a piecewise manner while the simplified version is similar to the existing anchor version

pub extern "C" fn margin_calculate_simplified_margin_requirement(
    user: &User,
    market_state: &MarketState,
    margin_type: MarginRequirementType,
    margin_buffer: u32,
) -> FfiResult<SimplifiedMarginCalculation>;

pub extern "C" fn incremental_margin_calculation_from_user(
    user: &User,
    market_state: &MarketState,
    margin_type: MarginRequirementType,
    timestamp: u64,
    margin_buffer: u32,
) -> IncrementalMarginCalculation;

Fixes

  • rm println from program logs

@jordy25519 jordy25519 merged commit cccc7aa into master Oct 21, 2025
1 check passed
@jordy25519 jordy25519 deleted the jordy/margin branch October 21, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant