Leverage delegate program
The leverage-delegate program: take-profit, stop-loss, entry and hLP orders.
Updated Sep 25, 2026
Orders are accounts on a second program. A position owner grants it a delegation on the Dusk program; the delegate then holds the order and, when a keeper executes it, approves the close through a before-hook and settles it through an after-hook inside delegated_close_leverage.
Entry orders and hLP orders escrow the user's assets in the delegate program until they fill, expire or are cancelled. See Leverage and Leverage and hedging.
Instructions
after_close_order
The delegate's after-hook: verify the settlement, pay the executor and the protocol order fee, finish or reduce the order.
- Caller
- A keeper, inside delegated_close_leverage
- Discriminator
9ce0eefa5fe5eb3b
Arguments
args: ExecuteOrderArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| order | writable | PDA ["leverage_order", order.position, order.owner, args.args.order_id] | |
| owner | writable | ||
| leverage_position | |||
| leverage_delegation | |||
| owner_token_account | |||
| executor_token_account | |||
| fee_recipient | |||
| token_mint | |||
| executor | across the delegated callback boundary. | ||
| futarchy_authority |
before_stop_loss
The delegate's before-hook: verify a stop-loss trigger and stage the close approval.
- Caller
- A keeper, inside delegated_close_leverage
- Discriminator
f63e52e8a8c7794e
Arguments
args: ExecuteOrderArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| order | writable | PDA ["leverage_order", leverage_position, order.owner, args.args.order_id] | |
| market | |||
| leverage_position | |||
| leverage_delegation | |||
| owner_token_account | |||
| fee_recipient | |||
| executor_token_account | |||
| futarchy_authority | |||
| collateral_mint | Collateral mint is needed to reproduce the exact net reserve credit for Token-2022 transfer-fee assets before approving a partial close. | ||
| token_mint | |||
| executor | across the delegated callback boundary. |
before_take_profit
The delegate's before-hook: verify a take-profit trigger and stage the close approval.
- Caller
- A keeper, inside delegated_close_leverage
- Discriminator
05236f00df83c11f
Arguments
args: ExecuteOrderArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| order | writable | PDA ["leverage_order", leverage_position, order.owner, args.args.order_id] | |
| market | |||
| leverage_position | |||
| leverage_delegation | |||
| owner_token_account | |||
| fee_recipient | |||
| executor_token_account | |||
| futarchy_authority | |||
| collateral_mint | Collateral mint is needed to reproduce the exact net reserve credit for Token-2022 transfer-fee assets before approving a partial close. | ||
| token_mint | |||
| executor | across the delegated callback boundary. |
cancel_hlp_order
Cancel an hLP order and return the escrowed shares.
- Caller
- The order owner
- In the app
- Portfolio · Orders
- Discriminator
81b2584df4270cc2
Arguments
args: HlpOrderIdArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| order | writable | PDA ["hlp_order", order.market, owner, order.target_hlp_mint, args.args.order_id] | |
| target_hlp_mint | |||
| custody_hlp_account | writable | ||
| owner_hlp_account | writable | ||
| owner | signer | ||
| token_2022_program | TokenzQd…xuEb |
cancel_leverage_entry_order
Cancel an unfilled entry order and return the escrowed margin.
- Caller
- The order owner
- In the app
- Portfolio · Orders
- Discriminator
ab2204562dd37752
Arguments
args: LeverageEntryOrderIdArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 | |
| min_owner_refund_out | u64 | Minimum amount actually credited to the owner on cancel or execution. Zero keeps cancellation available when transfer fees consume escrow. |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| order | writable | PDA ["leverage_entry_order", order.market, owner, args.args.order_id] | |
| debt_mint | writable | ||
| funding_vault | writable | ||
| owner_funding_account | writable | ||
| owner | writable · signer | ||
| token_program | Tokenkeg…Q5DA | ||
| token_2022_program | TokenzQd…xuEb |
cancel_leverage_order
Cancel an order and close its account.
- Caller
- The position owner
- In the app
- Portfolio · Orders
- Discriminator
1a58ad6aaff2cb7a
Arguments
_args: CancelLeverageOrderArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| order | writable | PDA ["leverage_order", order.position, owner, args.args.order_id] | |
| owner | writable · signer |
cancel_protection_order
Close a protection order and return its remaining escrowed LP shares to the owner.
- Caller
- The order owner
- In the app
- Portfolio · Protection orders
- Discriminator
2efe5336c1c5978a
Arguments
None.
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| order | writable | PDA ["protection_order", owner, order.order_id] | |
| lp_mint | |||
| custody_lp_account | writable | ||
| owner_lp_account | writable | ||
| owner | signer | ||
| token_2022_program | TokenzQd…xuEb |
create_hlp_order
Escrow hLP shares under a stop-loss (kind 1, on NAV per share) or stop-rate (kind 2, on the funding average) order.
- Caller
- The hLP holder
- In the app
- Earn · Orders
- Discriminator
41389dba6bd07da3
Arguments
args: CreateHlpOrderArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 | |
| kind | u8 | 1 for stop-loss, 2 for stop-rate. |
| hlp_amount | u64 | Shares escrowed. |
| trigger_nad | u64 | The NAV or funding APR that arms the order. |
| min_target_amount_out | u64 | Minimum received on execution, after bounties. |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| market | |||
| target_hlp_mint | |||
| base_mint | |||
| quote_mint | |||
| order | writable | PDA ["hlp_order", market, owner, target_hlp_mint, args.args.order_id] | |
| owner_hlp_account | writable | ||
| custody_hlp_account | writable | ||
| base_yield_account | writable | ||
| quote_yield_account | writable | ||
| owner | writable · signer | ||
| dusk_event_authority | PDA ["__event_authority"] | ||
| dusk_program | 2rYBVfGu…o16Y | ||
| token_2022_program | TokenzQd…xuEb | ||
| system_program | 11111111…1111 |
create_leverage_entry_order
Escrow margin for a limit entry: the position opens when the market reaches the price, before the expiry.
- Caller
- The future position owner
- In the app
- Leverage · Limit
- Discriminator
8eea74af19d09717
Arguments
args: CreateLeverageEntryOrderArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 | |
| position_id | pubkey | |
| debt_asset | u8 | |
| deposit_amount | u64 | Margin escrowed, plus the protocol fee deposit. |
| protocol_fee_deposit_amount | u64 | Additional gross fee funding, transferred separately so margin and bounty stay intact. |
| min_margin_amount | u64 | |
| executor_bounty | u64 | Paid to whoever fills the order. |
| multiplier_bps | u64 | Notional over margin at fill. |
| limit_price_nad | u64 | The price condition. |
| min_collateral_out | u64 | |
| expiry_unix_timestamp | i64 | One hour to thirty days out; no good-till-cancelled. |
| referrer | Option<pubkey> |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| market | |||
| debt_mint | |||
| collateral_mint | |||
| order | writable | PDA ["leverage_entry_order", market, owner, args.args.order_id] | |
| owner_funding_account | writable | ||
| funding_vault | writable | ||
| owner | writable · signer | ||
| token_program | Tokenkeg…Q5DA | ||
| token_2022_program | TokenzQd…xuEb | ||
| system_program | 11111111…1111 |
create_leverage_order
Create a take-profit (kind 1) or stop-loss (kind 2) order on a delegated leverage position.
- Caller
- The position owner
- In the app
- Leverage · TP/SL
- Discriminator
c5ce0adf592e5d11
Arguments
args: CreateLeverageOrderArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 | Owner-chosen id; part of the order address. |
| kind | u8 | 1 for take-profit, 2 for stop-loss. |
| trigger_closeout_price_nad | u64 | The closeout price that arms the order. |
| close_bps | u16 | How much of the position to close, 10,000 for all. |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| market | |||
| leverage_position | |||
| order | writable | PDA ["leverage_order", leverage_position, owner, args.args.order_id] | |
| owner | writable · signer | ||
| system_program | 11111111…1111 |
create_protection_order
Escrow LP shares for a borrow or leverage position and set the health trigger, repayment target, and keeper payment limits.
- Caller
- The order's owner, who need not own the position
- In the app
- Portfolio · Protection orders
- Discriminator
0a188c91311887c7
Arguments
args: CreateProtectionOrderArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 | |
| action | u8 | |
| debt_asset | u8 | |
| lp_amount | u64 | |
| max_lp_per_execution | u64 | |
| max_payment_per_execution | u64 | |
| trigger_health_bps | u64 | |
| target_health_bps | u64 | |
| min_payment_per_lp_nad | u64 | Minimum gross payment per LP smallest unit, scaled by 1e9. |
| keeper_fee_bps | u16 | |
| expires_at | i64 |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| market | |||
| borrow_position | optional | ||
| leverage_position | optional | ||
| lp_mint | |||
| base_mint | |||
| quote_mint | |||
| order | writable | PDA ["protection_order", owner, args.args.order_id] | |
| owner_lp_account | writable | ||
| custody_lp_account | writable | ||
| base_yield_account | writable | ||
| quote_yield_account | writable | ||
| owner | writable · signer | ||
| dusk_event_authority | PDA ["__event_authority"] | ||
| dusk_program | 2rYBVfGu…o16Y | ||
| token_2022_program | TokenzQd…xuEb | ||
| system_program | 11111111…1111 |
execute_hlp_order
Withdraw the escrowed shares to the target asset once the trigger holds, deducting the executor bounty and the protocol fee.
- Caller
- Any keeper
- Discriminator
ba32b16ca8ca8ec9
Arguments
args: HlpOrderIdArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| order | writable | PDA ["hlp_order", market, order.owner, order.target_hlp_mint, args.args.order_id] | |
| market | writable | ||
| futarchy_authority | |||
| base_mint | writable | ||
| quote_mint | writable | ||
| srlp_mint | writable | ||
| target_hlp_mint | writable | ||
| base_reserve_vault | writable | ||
| quote_reserve_vault | writable | ||
| borrowed_interest_vault | writable | ||
| custody_target_account | writable | ||
| custody_hlp_account | writable | ||
| hlp_srlp_account | writable | ||
| base_yield_account | writable | ||
| quote_yield_account | writable | ||
| owner_target_account | writable | ||
| executor_target_account | writable | ||
| executor | signer | ||
| order_owner | writable | ||
| dusk_event_authority | PDA ["__event_authority"] | ||
| dusk_program | 2rYBVfGu…o16Y | ||
| protocol_fee.fee_recipient | writable | ||
| token_program | Tokenkeg…Q5DA | ||
| token_2022_program | TokenzQd…xuEb |
execute_leverage_entry_order
Fill an entry order whose price condition holds, opening the position for its owner.
- Caller
- Any keeper
- Discriminator
63433961cc47ac90
Arguments
args: LeverageEntryOrderIdArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 | |
| min_owner_refund_out | u64 | Minimum amount actually credited to the owner on cancel or execution. Zero keeps cancellation available when transfer fees consume escrow. |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| order | writable | PDA ["leverage_entry_order", market, order.owner, args.args.order_id] | |
| market | writable | ||
| futarchy_authority | |||
| owner | writable | ||
| leverage_position | writable | ||
| debt_mint | writable | ||
| collateral_mint | |||
| debt_reserve_vault | writable | ||
| collateral_reserve_vault | writable | ||
| leverage_collateral_vault | writable | ||
| funding_vault | writable | ||
| owner_refund_account | writable | ||
| executor_bounty_account | writable | ||
| referral_partner | optional | ||
| referral_accrual | optional | ||
| instructions_sysvar | Sysvar1n…1111 | ||
| executor | writable · signer | ||
| dusk_event_authority | PDA ["__event_authority"] | ||
| dusk_program | 2rYBVfGu…o16Y | ||
| protocol_fee.fee_recipient | writable | ||
| token_program | Tokenkeg…Q5DA | ||
| token_2022_program | TokenzQd…xuEb | ||
| system_program | 11111111…1111 |
execute_protection_order
Use escrowed LP shares to repay an unhealthy position, then pay the keeper and protocol fees within the owner's limits.
- Caller
- Any keeper
- Discriminator
f3c130e0ada18157
Arguments
args: ExecuteProtectionOrderArgs
| Field | Type | Notes |
|---|---|---|
| lp_amount | u64 | |
| payment_amount | u64 | Maximum gross payment taken from the keeper's own token account. |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| order | writable | PDA ["protection_order", order.owner, order.order_id] | |
| market | writable | ||
| futarchy_authority | |||
| borrow_position | writable · optional | ||
| leverage_position | writable · optional | ||
| position_owner | |||
| base_mint | |||
| quote_mint | |||
| lp_mint | writable | ||
| srlp_mint | writable | ||
| base_reserve_vault | writable | ||
| quote_reserve_vault | writable | ||
| payment_vault | writable | Native repayment reserve or collateral donation vault, validated by Dusk. | |
| debt_interest_vault | writable | ||
| borrowed_interest_vault | writable · optional | ||
| hlp_srlp_account | writable · optional | ||
| custody_lp_account | writable | ||
| custody_base_account | writable | ||
| custody_quote_account | writable | ||
| base_yield_account | writable | ||
| quote_yield_account | writable | ||
| owner_base_account | writable | ||
| owner_quote_account | writable | ||
| keeper_payment_account | writable | ||
| referral_partner | optional | ||
| referral_accrual | writable · optional | ||
| keeper | writable · signer | ||
| dusk_event_authority | PDA ["__event_authority"] | ||
| dusk_program | 2rYBVfGu…o16Y | ||
| protocol_fee.fee_recipient | writable | ||
| token_program | Tokenkeg…Q5DA | ||
| token_2022_program | TokenzQd…xuEb |
fund_protection_order
Add owner-held LP shares to an existing protection order's escrow.
- Caller
- The order owner
- In the app
- Portfolio · Protection orders
- Discriminator
8cf4782889a659b2
Arguments
args: FundProtectionOrderArgs
| Field | Type | Notes |
|---|---|---|
| lp_amount | u64 |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| order | writable | PDA ["protection_order", owner, order.order_id] | |
| lp_mint | |||
| custody_lp_account | writable | ||
| owner_lp_account | writable | ||
| owner | signer | ||
| token_2022_program | TokenzQd…xuEb |
preview_protection_order
Read-only: calculate the linked position's health using the current market state and collateral mint.
- Caller
- Any client, by simulation
- Discriminator
90d39074ff66fcef
Arguments
None.
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| order | |||
| market | |||
| borrow_position | optional | ||
| leverage_position | optional | ||
| collateral_mint |
settle_hlp_order_yield
Pay yield that accrued to escrowed shares after the order left escrow.
- Caller
- Anyone
- Discriminator
0168c10d0d09f397
Arguments
args: HlpOrderIdArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| order | writable | PDA ["hlp_order", market, order.owner, order.target_hlp_mint, args.args.order_id] | |
| market | writable | ||
| futarchy_authority | PDA ["futarchy_authority"] | ||
| target_hlp_mint | |||
| custody_hlp_account | writable | ||
| owner_hlp_account | writable | ||
| base_mint | |||
| quote_mint | |||
| base_reserve_vault | writable | ||
| quote_reserve_vault | writable | ||
| base_interest_vault | writable | ||
| quote_interest_vault | writable | ||
| base_yield_account | writable | ||
| quote_yield_account | writable | ||
| owner_base_account | writable | ||
| owner_quote_account | writable | ||
| owner | writable | ||
| dusk_event_authority | PDA ["__event_authority"] | ||
| dusk_program | 2rYBVfGu…o16Y | ||
| token_program | Tokenkeg…Q5DA | ||
| token_2022_program | TokenzQd…xuEb |
update_leverage_order
Change an order's trigger price or size.
- Caller
- The position owner
- In the app
- Portfolio · Orders
- Discriminator
196565037de52ef2
Arguments
args: UpdateLeverageOrderArgs
| Field | Type | Notes |
|---|---|---|
| order_id | u64 | |
| kind | u8 | |
| trigger_closeout_price_nad | u64 | |
| close_bps | u16 |
Accounts
| Account | Flags | Resolution | Notes |
|---|---|---|---|
| market | |||
| leverage_position | |||
| order | writable | PDA ["leverage_order", leverage_position, owner, args.args.order_id] | |
| owner | writable · signer |
Accounts
The delegate program reads several Dusk accounts (Market, LeveragePosition, LeverageDelegation, YieldAccount, the referral accounts and the FutarchyAuthority) and owns the three order accounts.
BorrowPosition
A public credit position: collateral on both sides, fixed debt shares per side, stored liquidation factors, referral bindings and fields left from the retired liquidation auction.
- PDA seeds
- "borrow_position_v2", market, position id
- SDK helper
- deriveBorrowPositionAddress
- Discriminator
- f38c148b20f37237
| Field | Type | Notes |
|---|---|---|
| owner | pubkey | |
| market | pubkey | |
| position_id | pubkey | |
| base_collateral | u64 | |
| quote_collateral | u64 | |
| global_health_base_contribution_for_quote_debt | u64 | |
| global_health_quote_contribution_for_base_debt | u64 | |
| base_liquidation_cf_bps | u16 | |
| quote_liquidation_cf_bps | u16 | |
| base_referral_partner | pubkey | |
| quote_referral_partner | pubkey | |
| base_referral_interest_share_bps | u16 | |
| quote_referral_interest_share_bps | u16 | |
| fixed_base_shares | u128 | |
| fixed_quote_shares | u128 | |
| fixed_base_principal | u64 | Original base borrowed by this position that has not been repaid or written off. |
| fixed_quote_principal | u64 | Original quote borrowed by this position that has not been repaid or written off. |
| active_liquidation_session | pubkey | |
| auction_debt_asset | u8 | |
| auction_start_time | i64 | |
| auction_start_price_nad | u64 | |
| auction_floor_price_nad | u64 | |
| bump | u8 |
HlpOrder
An escrowed hLP stop-loss or stop-rate order: kind, status, shares, trigger and minimum output.
- PDA seeds
- "hlp_order", market, owner, target hLP mint, order id
- Discriminator
- a245440c2d0880d3
| Field | Type | Notes |
|---|---|---|
| owner | pubkey | |
| market | pubkey | |
| target_hlp_mint | pubkey | |
| custody_hlp_account | pubkey | |
| order_id | u64 | |
| kind | u8 | |
| status | u8 | |
| hlp_amount | u64 | |
| trigger_nad | u64 | |
| min_target_amount_out | u64 | |
| bump | u8 |
LeverageDelegation
The delegate program allowed to act on a leverage position and the actions it may take.
- PDA seeds
- "leverage_delegation_v2", position
- SDK helper
- deriveLeverageDelegationAddress
- Discriminator
- 313c1d17f3db10d6
| Field | Type | Notes |
|---|---|---|
| owner | pubkey | |
| market | pubkey | |
| position | pubkey | |
| debt_asset | u8 | |
| delegated_program | pubkey | |
| approved_actions | u32 | |
| open_curve_revision | u64 | |
| bump | u8 |
LeverageEntryOrder
An escrowed limit entry: margin, executor bounty, multiplier, limit price, minimum collateral, expiry and optional referrer.
- PDA seeds
- "leverage_entry_order", market, owner, order id
- Discriminator
- 30d28ac974aeed9f
| Field | Type | Notes |
|---|---|---|
| owner | pubkey | |
| market | pubkey | |
| position | pubkey | |
| position_id | pubkey | |
| debt_mint | pubkey | |
| collateral_mint | pubkey | |
| order_id | u64 | |
| debt_asset | u8 | |
| margin_amount | u64 | Gross vault debit forwarded to Dusk as margin. |
| executor_bounty | u64 | Minimum net credit paid to the successful executor. |
| multiplier_bps | u64 | |
| limit_price_nad | u64 | |
| min_collateral_out | u64 | |
| expiry_unix_timestamp | i64 | |
| referrer | Option<pubkey> | |
| bump | u8 |
LeverageOrder
A take-profit or stop-loss order on a delegated position: kind, trigger closeout price, size, and staged approval state.
- PDA seeds
- "leverage_order", position, owner, order id
- Discriminator
- e8a22d946a6a2584
| Field | Type | Notes |
|---|---|---|
| owner | pubkey | |
| market | pubkey | |
| position | pubkey | |
| open_curve_revision | u64 | |
| order_id | u64 | |
| kind | u8 | |
| trigger_closeout_price_nad | u64 | |
| close_bps | u16 | |
| staged_margin | u64 | |
| staged_collateral_amount | u64 | |
| staged_remaining_collateral_amount | u64 | |
| staged_remaining_debt_shares | u128 | |
| staged_remaining_debt_principal | u128 | |
| staged_owner_token_account | pubkey | |
| staged_owner_balance | u64 | |
| staged_fee_recipient | pubkey | |
| staged_fee_balance | u64 | |
| staged_executor_token_account | pubkey | |
| staged_executor_balance | u64 | |
| staged_output_mint | pubkey | |
| staged_output_amount | u64 | |
| staged_protocol_fee_debit | u64 | |
| staged_protocol_fee_credit | u64 | |
| staged_executor_credit | u64 | |
| staged_execution_value | u64 | Executed collateral-sale value in debt tokens, before debt repayment. |
| bump | u8 |
LeveragePosition
An isolated leverage position: debt asset, collateral, margin, notional, debt shares, multiplier and timestamps.
- PDA seeds
- "leverage_position_v2", market, position id
- SDK helper
- deriveLeveragePositionAddress
- Discriminator
- 584e7c44e48122fb
| Field | Type | Notes |
|---|---|---|
| owner | pubkey | |
| market | pubkey | |
| namespace_authority | pubkey | Funding signer that established this position. Ordinary opens use the owner; sponsored entry orders use their owner-created order PDA. |
| position_id | pubkey | |
| referral_partner | pubkey | |
| referral_interest_share_bps | u16 | |
| debt_asset | u8 | |
| collateral_amount | u64 | |
| margin_terms | LeverageMarginTerms | |
| margin_amount | u64 | Entry equity valued in debt-token atoms. |
| open_notional | u64 | |
| debt_principal | u128 | |
| debt_shares | u128 | |
| multiplier_bps | u64 | |
| opened_at | i64 | |
| opened_slot | u64 | |
| open_curve_revision | u64 | Market curve revision committed by this opening. A recreated PDA gets a new revision even if it reopens in the same slot. |
| active_liquidation_session | pubkey | |
| close_approval | CloseApprovalQuote | |
| bump | u8 |
LeverageMarginTerms
| Field | Type | Notes |
|---|---|---|
| reference_collateral | u64 | |
| maintenance_boundaries_bps | [u16; 2] | |
| maintenance_rates_bps | [u16; 3] | |
| entry_buffer_bps | u16 | |
| admission_equity_collateral_nad | u128 | Collateral atoms times NAD, not a fixed debt-token or dollar amount. Retained on equity extraction; released proportionally on size reduction. |
CloseApprovalQuote
| Field | Type | Notes |
|---|---|---|
| slot | u64 | |
| close_bps | u16 | |
| collateral_credit | u64 | |
| selected_output | u64 | |
| full_output | u64 |
Market
One market: configuration, curve state, both sides' reserves and fee liabilities, debt indexes, the two hLP vaults, risk observations, oracle policy, tranche capital and policy, the active jrLP mint, the income books, operator/manager authority and parameter revisions and the reduce-only flag.
- PDA seeds
- "market_v2", base mint, quote mint, params hash
- SDK helper
- deriveMarketAddress
- Discriminator
- dbbed53700e3c69a
| Field | Type | Notes |
|---|---|---|
| oracle | OracleState | |
| version | u8 | |
| srlp_mint | pubkey | |
| base_side | MarketSide | |
| quote_side | MarketSide | |
| config | MarketConfig | |
| amm | AmmState | |
| debt | Debt | |
| tranches | TrancheCapital | One shared junior capital budget across both reserve/debt books. |
| income | MarketIncomeBooks | |
| junior_exit_config | JuniorExitConfig | |
| tranche_policy | TranchePolicy | |
| junior_mint | pubkey | |
| base_hlp_vault | HlpVault | |
| quote_hlp_vault | HlpVault | |
| risk | Risk | |
| params_hash | [u8; 32] | |
| initial_liquidity_authority | pubkey | One-shot signer allowed to provide the first fully-backed Base/Quote seed. It is cleared permanently once srLP supply becomes nonzero. |
| operator | OperatorState | Sole per-market authority; token ownership carries no configuration rights. |
| protocol_interest_markup_bps | u16 | Internal mirror of the global FutarchyAuthority markup, never an operator parameter. |
| parameter_revisions | [u64; 7] | Independent monotone revisions for fee, concentration, IRM, EMA, daily-borrow-limit, center-controller, and tranche parameter families. |
| last_marginal_observation_nad | u64 | Latest trader-visible marginal price committed by a curve mutation. |
| curve_revision | u64 | Monotone revision for executable-curve mutations. |
| risk_revision | u64 | Curve revision represented by the materialized lending-risk snapshot. |
| last_update_slot | u64 | |
| reduce_only | bool | |
| bump | u8 |
OracleState
| Field | Type | Notes |
|---|---|---|
| policy | OraclePolicy | |
| last_observation | OracleObservation | |
| revision | u64 | |
| recognized_tail_liquidity | u128 | Recognized native-tail depth cannot grow merely because an OP trade moves to a different native invariant. Real ordinary LP capital scales the ceiling through its share supply; losses reduce it immediately. |
| recognized_ordinary_supply | u64 | |
| runtime | RuntimePricing |
OraclePolicy
| Field | Type | Notes |
|---|---|---|
| format | u8 | |
| provider | pubkey | |
| base_account | pubkey | |
| quote_account | pubkey | |
| base_feed_id | [u8; 32] | |
| quote_feed_id | [u8; 32] | |
| lambda_bps | u16 | |
| adjustment_cap_nad | u64 | |
| max_age_seconds | u32 | |
| max_age_slots | u64 | |
| max_confidence_bps | u16 | |
| max_publish_skew_seconds | u32 |
OracleObservation
| Field | Type | Notes |
|---|---|---|
| price_nad | u64 | |
| confidence_nad | u64 | |
| publish_time | i64 | |
| posted_slot | u64 | |
| sequence | u64 | |
| hash | [u8; 32] | |
| source_times | [i64; 2] | |
| source_slots | [u64; 2] | |
| source_sequences | [u64; 2] | Independent counters retain replay protection when only one leg updates. |
| source_hashes | [[u8; 32]; 2] | Each normalized report is immutable at an already observed counter. |
RuntimePricing
| Field | Type | Notes |
|---|
MarketSide
| Field | Type | Notes |
|---|---|---|
| asset_mint | pubkey | |
| asset_decimals | u8 | |
| hlp_mint | pubkey | |
| reserve_vault | pubkey | |
| collateral_vault | pubkey | |
| interest_vault | pubkey | |
| reserves | Reserves | |
| shares | ReserveShares | |
| fees | Fees | |
| daily_borrow_bucket | DailyBorrowBucket |
Reserves
| Field | Type | Notes |
|---|---|---|
| flash_receivable | u64 | Same-transaction collateral receivable. Included in backing, excluded from cash available to swaps, loans and withdrawals. |
| live_reserve | u128 | Wider than SPL custody: includes cash, indexed public debt and synthetic hLP backing. Unpaid interest never becomes executable curve inventory. |
| cash_reserve | u64 | |
| base_hlp_backing_inventory | u64 | Physical reserve-vault atoms removed from executable AMM inventory by base-hLP deleveraging. They are conservation-only bookkeeping, excluded from hLP NAV and exit output, and return to executable cash pro rata as base hLP exits. |
| quote_hlp_backing_inventory | u64 | Quote-hLP counterpart of `base_hlp_backing_inventory`; never a second hLP NAV or withdrawal claim. |
| protected_recenter_reserve | u64 | Physical reserve-vault atoms retained from toxicity surcharge for a future protected recenter. They are custody-backed but excluded from executable cash/live reserves, srLP NAV, and every withdrawal claim. |
ReserveShares
| Field | Type | Notes |
|---|---|---|
| srlp_supply | u64 |
Fees
| Field | Type | Notes |
|---|---|---|
| junior | TrancheIncome | |
| public_interest_advance | PublicInterestAdvance | |
| swap_fee_growth_index_q64 | u128 | |
| interest_growth_index_q64 | u128 | |
| swap_fee_growth_remainder_scaled | u64 | Scaled fee entitlement not yet representable by the integer growth index. The corresponding whole-token backing already sits in `swap_fee_liability`; it must never be redistributed as unallocated revenue. |
| interest_growth_remainder_scaled | u64 | Interest counterpart of `swap_fee_growth_remainder_scaled`. |
| hlp_funding_interest_growth_remainder_scaled | u64 | Source-scoped Q64 carry for interest paid by hLP funding debt. Funding uses a non-hLP denominator, while public interest uses total srLP supply; sharing one carry across those denominators would eventually leak rounding entitlement between the two populations. |
| swap_fee_custody_balance | u64 | Claimable swap fees physically held in the reserve vault but excluded from executable cash and live reserves. |
| interest_vault_balance | u64 | |
| swap_fee_liability | u64 | |
| interest_liability | u64 | |
| unallocated_swap_fee_liability | u64 | |
| unallocated_interest_liability | u64 | |
| swap_protocol_fee_liability | u64 | |
| swap_buyback_fee_liability | u64 | |
| interest_protocol_fee_liability | u64 | |
| interest_buyback_fee_liability | u64 | |
| referral_interest_liability | u64 | |
| revenue_interest_liability | u64 | Shared custody for operator claims and protocol fractional carry. |
| fee_auction_reference_market | pubkey | Governance-approved reference market for fee-lane auctions. A default key permits only the sold market itself when it directly pairs the sold and accepted mints. |
| buyback_auction_reference_market | pubkey | Governance-approved reference market for buyback-lane auctions. A default key has the same direct-market-only meaning as above. |
| fee_swap_auction_epoch | ProtocolAuctionEpoch | |
| fee_interest_auction_epoch | ProtocolAuctionEpoch | |
| buyback_swap_auction_epoch | ProtocolAuctionEpoch | |
| buyback_interest_auction_epoch | ProtocolAuctionEpoch |
DailyBorrowBucket
| Field | Type | Notes |
|---|---|---|
| borrowed_bucket | u64 | Gross principal lent out through the public borrow path. Internal hLP funding and isolated leverage do not consume this capacity. This is a 24-hour leaky/token bucket, not an exact trailing-window sum: it permits a full burst after idle and then refills at the configured daily rate. |
| last_decay_slot | u64 | |
| decay_remainder_ms | u64 | Numerator remainder from `limit * elapsed_ms / MS_PER_DAY`. For a fixed absolute limit, carrying it makes refill independent of how often the bucket is checkpointed. The bps-derived absolute limit can still move when conservative market depth changes. |
MarketConfig
| Field | Type | Notes |
|---|---|---|
| swap_fee_bps | u16 | |
| divergence_fee_share_cap_bps | u16 | |
| volatility_fee_share_cap_bps | u16 | |
| target_hlp_leverage_bps | u16 | |
| settlement_divergence_bps | u16 | |
| ema_half_life_ms | u64 | |
| directional_ema_half_life_ms | u64 | |
| curve_depth_ema_half_life_ms | u64 | |
| max_daily_borrow_bps | u16 | |
| global_health_contribution_cap_bps | u16 | |
| borrow_market_health_floor_bps | u16 | |
| amm | AmmConfig | |
| irm | RiskRateConfig | |
| start_time | i64 |
AmmConfig
| Field | Type | Notes |
|---|---|---|
| peak_amplification_nad | u64 | |
| core_half_width_bps | u16 | |
| fade_width_bps | u16 | |
| center_ema_half_life_ms | u64 | |
| volatility_half_life_ms | u64 | |
| adjustment_step_nad | u64 | |
| volatility_shock_cap_nad | u64 | |
| volatility_cap_nad | u64 | |
| divergence_fee_coefficient_nad | u64 | |
| volatility_fee_coefficient_nad | u64 | |
| swap_fee_collect_mode | u8 | Asset in which swap, toxicity, volatility, and retained-recenter fees are denominated. Lending and hLP funding interest remain in the borrowed asset and are not affected by this setting. |
| compounding_fee_bps | u16 | Share of the LP-owned swap fee which becomes ordinary reserve principal instead of a claimable fee liability. Zero disables native compounding; `BPS_DENOMINATOR` compounds the complete LP share. |
| launch_fee_start_bps | u16 | Optional launch-only base fee. The premium above `swap_fee_bps` decays from `start_time` and is zero after the configured duration. |
| launch_fee_duration_seconds | u64 | |
| launch_fee_decay_mode | u8 | |
| launch_market_price_step_bps | u16 | When all three values are zero, the launch fee follows the time schedule above. A fully nonzero tuple selects a price-milestone scheduler whose reference price is bound by the first liquidity seed. |
| launch_market_number_of_periods | u16 | |
| launch_market_reduction_factor_bps | u16 | |
| launch_rate_limit_asset | u8 | Optional launch buy-size limiter. The configured asset is the asset being bought, not the input asset. Each full/partial reference amount after the first adds `launch_rate_limit_increment_bps`, capped by `launch_rate_limit_max_fee_bps`. |
| launch_rate_limit_reference_nad | u64 | |
| launch_rate_limit_increment_bps | u16 | |
| launch_rate_limit_max_fee_bps | u16 | |
| launch_rate_limit_duration_seconds | u64 | |
| reserved | [u8; 0] |
RiskRateConfig
| Field | Type | Notes |
|---|---|---|
| lower_signal_nad | u64 | |
| upper_signal_nad | u64 | |
| lower_utilization_bps | u16 | |
| upper_utilization_bps | u16 | |
| half_life_ms | u64 | |
| initial_apr_nad | u64 |
AmmState
| Field | Type | Notes |
|---|---|---|
| initialized | bool | |
| concentration_ramp | ConcentrationRamp | |
| concentrated_curve_cache | ConcentratedCurveCache | Concentrated CPMM-tail/band geometry. CPMM is represented by zero concentrated liquidity in this same cache. |
| center_price_nad | u64 | |
| price_ema_nad | u64 | |
| last_trade_price_nad | u64 | |
| last_observation_slot | u64 | |
| last_adjustment_slot | u64 | |
| launch_reference_price_nad | u64 | Immutable launch price reference bound by the first fully-backed liquidity seed. Zero is allowed only before that seed. |
| launch_fee_progress_offset | u16 | Fee-schedule progress already completed by a bootstrap adapter before the market graduates into GAMM. |
| volatility_accumulator_nad | u64 | |
| curve_depth_per_share_nad | u128 | |
| protected_floor_per_share_nad | u128 | srLP principal floor protected from funded recenter/ramp impairment. |
| retention_required_nad | u128 | Fresh protected-profit target that arms retained surcharge routing. This is a principal-budget target, never a cap on trader fees. |
| retention_stop_nad | u128 | Hysteresis threshold below which retention remains armed. |
| retention_hard_cap_nad | u128 | Maximum protected principal one controller target may request/spend. It does not clip divergence or volatility surcharge amounts. |
| retain_dynamic_surcharge | bool | When true, dynamic surcharge is locked in the non-quoteable protected recenter bucket; when false, the identical trader charge is routed to claimable srLP fee accounting. |
| retention_target_saturated | bool | The requested protection target exceeded its principal-budget cap. |
| retention_target_stale | bool | The protected bucket changed after the last exact forward-target solve. While stale, retention stays on until a decision point refreshes the target or executes a funded recenter. |
| deferred_controller_target | DeferredControllerTarget | Exact unfunded controller target retried by later real operations. |
| frozen_hlp_mask | u8 | A distressed hLP cannot be reconstructed as positive one-sided equity. Each bit freezes only that vault's share/debt hedge during swaps. |
| frozen_base_vault_base_offset_nad | i128 | Fixed virtual-coordinate adjustment captured when the vault freezes. It preserves the pre-freeze executable price without treating the vault's negative equity as spendable token inventory. |
| frozen_base_vault_quote_offset_nad | i128 | |
| frozen_quote_vault_base_offset_nad | i128 | |
| frozen_quote_vault_quote_offset_nad | i128 | |
| _reserved | [u8; 0] |
ConcentrationRamp
| Field | Type | Notes |
|---|---|---|
| active | bool | |
| start | ConcentratedCurveParameters | |
| target | ConcentratedCurveParameters | |
| start_slot | u64 | |
| end_slot | u64 | |
| last_attempt_slot | u64 | Successful or rejected steps are attempted at most once per slot. |
ConcentratedCurveCache
| Field | Type | Notes |
|---|---|---|
| math_revision | u8 | |
| peak_amplification_nad | u64 | |
| core_half_width_bps | u16 | |
| fade_width_bps | u16 | |
| tail_liquidity | u128 | |
| concentrated_liquidity | u128 | |
| core_lower_sqrt_price_nad | u128 | |
| core_upper_sqrt_price_nad | u128 | |
| outer_lower_sqrt_price_nad | u128 | |
| outer_upper_sqrt_price_nad | u128 |
DeferredControllerTarget
| Field | Type | Notes |
|---|---|---|
| kind | u8 | 0 = none, 2 = center move. |
| center_price_nad | u64 | |
| required_nad | u128 | |
| evaluated_base_reserve_nad | u128 | |
| evaluated_quote_reserve_nad | u128 | |
| created_slot | u64 | |
| saturated | bool |
Debt
| Field | Type | Notes |
|---|---|---|
| fixed_base_shares | u128 | |
| fixed_quote_shares | u128 | |
| base_borrow_index_nad | u128 | |
| quote_borrow_index_nad | u128 | |
| base_borrow_index_remainder | u128 | Fractional index growth carried across checkpoints. Denominator is `NAD * MS_PER_YEAR`, so frequent checkpoints cannot discard interest. |
| quote_borrow_index_remainder | u128 | |
| base_borrow_apr_nad | u128 | |
| quote_borrow_apr_nad | u128 | |
| base_borrow_apr_fraction_e18 | u64 | Fractional NAD APR carried by the exponential controller (scale 1e9). |
| quote_borrow_apr_fraction_e18 | u64 | |
| global_health_base_contribution_for_quote_debt | u64 | |
| global_health_quote_contribution_for_base_debt | u64 | |
| base_last_accrual_slot | u64 | |
| quote_last_accrual_slot | u64 | |
| fixed_base_principal | u64 | Aggregate outstanding *principal* (borrowed token amount, excluding accrued interest) backing fixed margin debt on each side. Accrued interest is `fixed_*_debt - fixed_*_principal`; tracked so interest can be routed to the interest vault (non-compounding) instead of compounding into reserves. Principal is a raw token-atom balance and is therefore bounded by the corresponding `u64` reserve custody domain. |
| fixed_quote_principal | u64 | |
| isolated_base_shares | u128 | Aggregate isolated leverage debt. This debt contributes to utilization and interest, but is intentionally not utilized as normal margin debt. Shares remain `u128`; raw principal remains in the token account's `u64` amount domain. |
| isolated_quote_shares | u128 | |
| isolated_base_principal | u64 | |
| isolated_quote_principal | u64 | |
| leverage_base_collateral | u64 | Gross collateral atoms in debt-bearing leverage positions. Counts all owners and namespaces; custody donations cannot create exposure credit. |
| leverage_quote_collateral | u64 |
TrancheCapital
| Field | Type | Notes |
|---|---|---|
| junior_reserve_shares | u64 | |
| junior_receipt_supply | u64 | |
| permanent_receipts | u64 | Funded, nonredeemable protocol receipts; included in junior supply. |
| queued_receipts | u64 | Escrow remains junior until a successful conversion or cancellation. |
| generation | u64 |
MarketIncomeBooks
| Field | Type | Notes |
|---|---|---|
| books | [IncomeReceivableBook; 4] | base public, quote public, base hLP funding, quote hLP funding. |
| revenue | [InterestRevenueBook; 4] | |
| pending | [u64; 4] | Gross settlement budget awaiting measured net custody credit. |
| seed | [IncomeReceivableClaim; 4] | |
| hlp | [[IncomeReceivableClaim; 2]; 2] | [hLP target][income asset], owned by the vault rather than its holders. |
| junior_end | [IncomeExposureEnd; 4] | |
| split_carry_bps | [u16; 4] |
IncomeReceivableBook
| Field | Type | Notes |
|---|---|---|
| epoch | u64 | |
| unpaid | u64 | |
| units | u64 | |
| paid_per_unit_q64 | u128 | |
| paid_remainder | u64 | |
| growth | [ReceivableGrowth; 4] | Ordinary senior, junior, base hLP, quote hLP. |
InterestRevenueBook
| Field | Type | Notes |
|---|---|---|
| gross_unpaid | u64 | |
| protocol_unpaid | u64 | |
| operator_unpaid | u64 | |
| pending_gross | u64 | |
| pending_protocol_gross | u64 | |
| operator_claimable | u64 | |
| protocol_fraction_q64 | u64 | |
| operator_fraction_q64 | u64 | |
| protocol_cash_fraction_q64 | u64 |
IncomeReceivableClaim
| Field | Type | Notes |
|---|---|---|
| epoch | u64 | |
| units_q64 | u128 | |
| paid_checkpoint_q64 | u128 | |
| growth_checkpoint | ReceivableGrowth | |
| paid_fraction_q128 | u128 | |
| claimable | u64 |
IncomeExposureEnd
| Field | Type | Notes |
|---|---|---|
| ended | bool | |
| epoch | u64 | |
| growth | ReceivableGrowth |
JuniorExitConfig
| Field | Type | Notes |
|---|---|---|
| minimum_notice_slots | u64 | |
| maximum_notice_slots | u64 | |
| exercise_window_slots | u64 |
TranchePolicy
| Field | Type | Notes |
|---|---|---|
| junior_income_share_bps | u16 |
HlpVault
| Field | Type | Notes |
|---|---|---|
| flash_collateral_debit | u64 | Collateral committed to one atomic flash recovery. Receipt supply is fixed until settlement; retail operations on other positions may run. |
| srlp_vault | pubkey | |
| srlp_shares | u64 | |
| base_hlp_live_reserve | u64 | hLP-owned live reserve depth that is not backed by reserve cash or normal cash-backed debt. This is the explicit synthetic live component in `r_virtual = r_cash + r_cash_backed_debt + r_hlp_live`. |
| quote_hlp_live_reserve | u64 | |
| debt_shares | u128 | Funding debt used by the hLP vault. It accrues interest and counts toward utilization, but is not same-side cash-backed reserve debt. |
| debt_principal | u64 | Raw borrowed token atoms; products and indexed shares stay `u128`. |
| hlp_supply | u64 | |
| residual_exposure | i128 | |
| base_swap_fee_growth_index_q64 | u128 | |
| base_interest_growth_index_q64 | u128 | |
| quote_swap_fee_growth_index_q64 | u128 | |
| quote_interest_growth_index_q64 | u128 | |
| base_swap_fee_checkpoint_q64 | u128 | |
| base_interest_checkpoint_q64 | u128 | |
| quote_swap_fee_checkpoint_q64 | u128 | |
| quote_interest_checkpoint_q64 | u128 | |
| base_swap_fee_remainder_q64 | u64 | Aggregate sub-atom srLP entitlement carried across hLP checkpoints. These are distinct from each holder YieldAccount remainder: this layer converts vault-owned srLP growth into hLP growth without double-flooring. |
| base_interest_remainder_q64 | u64 | |
| quote_swap_fee_remainder_q64 | u64 | |
| quote_interest_remainder_q64 | u64 | |
| base_swap_fee_growth_remainder_scaled | u64 | Sub-index distribution carry for the second, srLP-to-hLP allocation layer. Whole-token backing represented here has already left the corresponding `unallocated_*` bucket. |
| base_interest_growth_remainder_scaled | u64 | |
| quote_swap_fee_growth_remainder_scaled | u64 | |
| quote_interest_growth_remainder_scaled | u64 | |
| unallocated_base_swap_fee_amount | u64 | |
| unallocated_base_interest_amount | u64 | |
| unallocated_quote_swap_fee_amount | u64 | |
| unallocated_quote_interest_amount | u64 | |
| last_nav_nad | u128 | |
| cached_settlement_price_nad | u128 | Base quoted in quote NAD units for either target asset; zero means unset. |
| funding_apr_ema_nad | u128 | Smoothed APR of the opposite asset borrowed by this target-asset hLP. The fixed twelve-hour half-life gives Stop Rate orders stable semantics. |
| funding_apr_ema_last_slot | u64 |
Risk
| Field | Type | Notes |
|---|---|---|
| base_price_ema_nad | u64 | |
| quote_price_ema_nad | u64 | |
| directional_base_price_ema_nad | u64 | |
| directional_quote_price_ema_nad | u64 | |
| cached_spot_base_price_nad | u64 | |
| cached_spot_quote_price_nad | u64 | |
| observed_curve_depth_nad | u128 | Last observed total active curve depth in market amount units (see Market). |
| curve_depth_ema_nad | u128 | EMA of total active curve depth in market amount units (see Market). |
| last_snapshot_slot | u64 |
OperatorState
| Field | Type | Notes |
|---|---|---|
| authority | pubkey | |
| manager | pubkey | Optional parameter delegate; operator ownership and revenue stay with authority. |
| epoch | u64 | |
| revenue_epoch | u64 | |
| next_nonce | u64 | Monotone across authority transfers; a closed proposal PDA cannot be reused. |
| pending | pubkey | |
| pending_author | pubkey | Prevents a manager from replacing an operator-authored bundle. |
| revenue_recipient | pubkey | |
| interest_share_bps | u16 |
ProtectionOrder
An owner-funded LP escrow and execution limits for restoring a borrow or leverage position's health.
- PDA seeds
- "protection_order", owner, order id
- Discriminator
- fd52005bb2d560b9
| Field | Type | Notes |
|---|---|---|
| owner | pubkey | |
| market | pubkey | |
| position | pubkey | |
| position_owner | pubkey | |
| lp_mint | pubkey | |
| custody_lp_account | pubkey | |
| order_id | u64 | |
| action | u8 | 0: borrow repayment; 1: borrow collateral donation; 2: leverage repayment. |
| debt_asset | u8 | |
| active | bool | |
| remaining_lp | u64 | |
| max_lp_per_execution | u64 | |
| max_payment_per_execution | u64 | |
| trigger_health_bps | u64 | |
| target_health_bps | u64 | |
| min_payment_per_lp_nad | u64 | Minimum gross payment per LP smallest unit, scaled by 1e9. |
| keeper_fee_bps | u16 | |
| expires_at | i64 | |
| bump | u8 |
ReferralAccrual
A partner's claimable interest for one market and asset mint.
- PDA seeds
- "referral_accrual", partner, market, asset mint
- SDK helper
- deriveReferralAccrualAddress
- Discriminator
- 23f61942aea03027
| Field | Type | Notes |
|---|---|---|
| referral_partner | pubkey | |
| market | pubkey | |
| asset_mint | pubkey | |
| amount | u64 | |
| bump | u8 |
ReferralPartner
A listed referrer: its authority, recipient, interest share and active flag.
- PDA seeds
- "referral_partner", authority
- SDK helper
- deriveReferralPartnerAddress
- Discriminator
- ea36a99d8ebbe1d6
| Field | Type | Notes |
|---|---|---|
| authority | pubkey | |
| recipient | pubkey | |
| interest_share_bps | u16 | |
| active | bool | |
| bump | u8 |
YieldAccount
Per owner, market, LP mint, asset and kind: checkpoints against the growth indexes and income books, accrued amounts, jrLP held in an exit request, the recipient and an optional harvest authority.
- PDA seeds
- "yield", market, owner, LP mint, asset mint, kind
- SDK helper
- deriveYieldAccountAddress
- Discriminator
- e9f17706020e6a9c
| Field | Type | Notes |
|---|---|---|
| owner | pubkey | |
| market | pubkey | |
| lp_mint | pubkey | LP mint whose balance earns this account's revenue stream. This keeps base-hLP, quote-hLP, and srLP entitlements in disjoint PDA namespaces. |
| asset_mint | pubkey | |
| token_kind | u8 | |
| recipient | pubkey | |
| swap_fee_checkpoint_q64 | u128 | |
| interest_checkpoint_q64 | u128 | |
| accrued_swap_fee_amount | u64 | |
| accrued_interest_amount | u64 | |
| swap_fee_remainder_q64 | u64 | Sub-token fixed-point entitlement carried across checkpoints. Keeping this remainder prevents transfer/checkpoint frequency from destroying holder yield through repeated flooring. |
| interest_remainder_q64 | u64 | |
| bump | u8 | |
| harvest_authority | Option<pubkey> | Optional caller allowed to harvest to the recipient without controlling the LP or changing either yield permission. Only the owner may set it. |
| income_initialized | bool | |
| income | [IncomeReceivableClaim; 2] | |
| escrow_balance | u64 | Owner's junior exit escrow receipts. Historical unpaid-income ownership is checkpointed here alongside the liquid balance. |
IncomeReceivableClaim
| Field | Type | Notes |
|---|---|---|
| epoch | u64 | |
| units_q64 | u128 | |
| paid_checkpoint_q64 | u128 | |
| growth_checkpoint | ReceivableGrowth | |
| paid_fraction_q128 | u128 | |
| claimable | u64 |
ReceivableGrowth
| Field | Type | Notes |
|---|---|---|
| units_q64 | u128 | |
| weighted_paid_q128 | [u64; 4] |
Errors
Leverage delegate program errors · 6 of 6
| Code | Name | Message |
|---|---|---|
| 6000 | InvalidOrder | Invalid leverage order |
| 6001 | TriggerNotMet | Order trigger is not met |
| 6002 | InvalidTokenAccount | Invalid token account |
| 6003 | MathOverflow | Math overflow |
| 6004 | ApprovalSerializationFailed | Approval serialization failed |
| 6005 | InvalidMarketVersion | Unsupported Dusk market version |