Skip to main content
Coordinates the atomic Pyth + redeem PTB on expiry and distributes the DarkPool protocol fee on top of any Predict fees.

Fee split

const PROTOCOL_FEE_BP: u64 = 100;   // 1% of position payout
const RESOLVER_FEE_BP: u64 = 50;    // 0.5%
const CREATOR_FEE_BP: u64 = 50;     // 0.5%
const FEE_BASIS: u64 = 10_000;
2% total, on top of Predict’s existing fee that flows to vault LPs as yield.

AutoRedeemQueue

Shared object for users who opted into batch redemption. The resolver keeper reads opted-in entries on expiry and settles them in batch (one PTB per position to isolate aborts).
public struct AutoRedeemQueue has key {
    id: UID,
    entries: Table<ID, vector<RedeemTicket>>,    // MarketLink ID -> tickets
}

public struct RedeemTicket has store, copy, drop {
    predict_manager_id: ID,
    market_kind: u8,                  // 0 = binary, 1 = range
    expected_payout_estimate: u64,
}

distribute_fees<COLLATERAL>

public fun distribute_fees<COLLATERAL>(
    market: &MarketLink,
    gross: Coin<COLLATERAL>,
    protocol_addr: address,
    resolver_addr: address,
    ctx: &mut TxContext,
): Coin<COLLATERAL>;
Splits gross into 4 parts: protocol fee, resolver fee, creator fee, net. Transfers the three fees to their respective addresses and returns the net coin for the caller to forward to the user. Emits SettlementEvent { market_link_id, resolver, total_winners_redeemed, gross_payout, protocol_fee, resolver_fee, creator_fee }.

Tests

tests/settlement_tests.move. Verifies the 2% total fee invariant from BP constants.