open_account, set_session, deposit, withdraw, place_orders, swap_pool, commit_order and the rest) are listed on Trading account and Order book. This page covers the rebate.
Accounts
RebateMarket PDA
market is the mint-redeem Market PDA. The pot is the cUSDC token account at [b"rebate_pot", market], owned by this PDA.
RebatePosition PDA
trader is the account’s trader address. The S it holds is in the vault, a token account at [b"rebate_vault", market, trader] owned by the position PDA.
All four seeds are under the trading program.
Instructions
The keeper here is the market’s CLP authority.
amount is in S atoms for stake and unstake, and in cUSDC atoms for funding. Stake, unstake and claim each accrue the index and settle the position before they move anything, which is why S earns exactly while it is staked.
refresh_rebate
Accounts: mr_market, clp, rebate (writable). The remaining accounts are the exposure inventory, the same four the exposure cap reads: the pool’s long and short synth vaults, then the CLP’s long and short token accounts. A market whose oi_cap is 0 reads no exposure and gets a rate of 0.
It accrues the index at the old rate first, then updates the rate, so a refresh never rewrites the past. The 14-day average steps only after 900 seconds since its last step. The yield is re-measured after at least a day. It emits RebateRefreshed.
open_rebate_position
Accounts: payer (signer, writable), account, trader, mr_market, rebate, position (writable), vault (writable), short_mint, token_program, system_program. It only creates an empty position and vault, so anyone may pay the rent for it. The position starts with debt set to the current index, so it earns nothing for the past.
stake_rebate
Accounts: authority (signer), account, trader, mr_market, clp, rebate, position, vault, trader_short, token_program. The S comes from the trader’s associated token account for the market’s S mint. The trader address signs the transfer inside the program. The keeper may stake for an account, which only ever moves S into that account’s own vault.
unstake_rebate
Takes the same accounts as stake_rebate. Only the owner or the account’s active session key may sign it. The keeper may never unstake. It fails with InsufficientStake (6019) when amount is more than the position holds, and with SessionExpired when a session key has expired.
claim_rebate
Accounts: authority (signer), account, trader, mr_market, clp, rebate, position, pot, trader_usdc, token_program. trader_usdc must be the trader’s associated cUSDC account, whoever signs, so a claim can’t be redirected. A claim with nothing earned succeeds and moves nothing.
Events
In
RebateRefreshed, exposure is traders’ net position E in cUSDC atoms (0 while the market is uncapped), and pot_free is the pot’s cUSDC not yet committed to the index.
Errors
The rebate adds two errors to the trading program’s list.
Rebate instructions also use
NotAuthorized, SessionExpired, ZeroAmount, WrongTokenAccount and MathOverflow. See Errors.
See also
Short rebate
The rate, the cap and the pot.
Trading account
Setting up the account and staking from it.
Programs overview
Every program and its signers.

