deepbook-margin-referral
Installation
SKILL.md
DeepBook Margin: Supply Referral System
The supply referral system allows users to earn a portion of the protocol fees generated by liquidity suppliers they refer. When a supplier deposits assets using a referral ID, the referrer earns fees proportional to the interest paid by borrowers over time.
1. How It Works
The referral system uses a shares-based tracking mechanism:
- Create Referral: Mint a
SupplyReferralobject for a specific margin pool. - Referral ID: Suppliers provide your referral ID when depositing/supplying liquidity to the pool.
- Accumulate Shares: The referrer's shares in the pool's referral tracker increase proportionally to the supplier's deposited position size.
- Earn Fees: As borrowers pay interest, a percentage goes to protocol fees, and a portion of those protocol fees is distributed to the referrer's claimable fees.
- Withdrawal Decrease: When a referred supplier withdraws their liquidity, the referrer's tracking shares decrease.
- Claim Fees: Referrers can claim and withdraw accumulated fees at any time.