Skip to main content

Deposit with Referral

A UserMetadata account stores the referrer information. The referrer must be included when the account is created. After it is set, the referrer cannot be changed.
1

Import Dependencies

2

Load Market and Initialize RPC

3

Check the Referrer on Record

The referrer is stored in the wallet’s user metadata, created by its first Kamino deposit. If the account already exists, pass the referrer on record.
The referrer can only be set when the user metadata account is created and can’t be changed after. A wallet that already used Kamino without a referral has DEFAULT_PUBLIC_KEY (11111111111111111111111111111111) on record, meaning no referrer, and can’t get one. Passing a different referrer than the one on record makes the transaction fail.
4

Build Deposit Instructions with Referrer

Deposit USDC as collateral with the referrer attached.
5

Build the Transaction

6

Sign and Send

The deposit with referral is complete. The referrer is linked to the account and earns a share of the interest it pays on borrows.