Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.glam.systems/llms.txt

Use this file to discover all available pages before exploring further.

Follow the steps in the CLI introduction to install the GLAM CLI.
All transactions mentioned on this page were executed on mainnet using GLAM CLI v1.0.2. There might be some differences in the most recent versions. Check help messages first if you encounter any issues.

Preparation

Before starting, ensure you have:
  • Solana keypairs for each persona. Create new keypairs with solana-keygen new -o keypair.json. See Solana CLI docs for more details.
  • SOL in each account for transaction fees.
  • USDC for the user account to subscribe to the vault.
  • Jupiter API key (optional but recommended). Required for commands that fetch token prices (e.g., vault token-balances). Get one for free on Jupiter Developer Platform.

Setup

In this quickstart, there are three personas:
  • Vault owner: creates a vault, configures it, and grants the delegate proper permissions for operations.
    • HQsXBSrJait1Gt8FJSNhf87p8cddRAy4WEbGzQvdeC3M
    • Funded with 0.1 SOL
  • Delegate: allocates fund, and fulfills user requests.
    • ndcXmTFuMPkJ5mE4sYNnZdSo99Ajzny88xnrids4QnG
    • Funded with 0.01 SOL
  • User: subscribes to the vault, then redeems shares.
    • gpoPk9Aa7yZoFsfkAUiaH85UsdDvoFz8gZrTGbjtAX8
    • Funded with 0.01 SOL plus 5 USDC
Prepare CLI configs for each persona:
owner-config.json
{
  "cluster": "mainnet-beta",
  "json_rpc_url": "https://mainnet.helius-rpc.com/?api-key=<api-key>",
  "keypair_path": "/path/to/owner-keypair.json",
  "priority_fee": { "micro_lamports": 5000 },
  "jupiter_api_key": "<jupiter-api-key>"
}
manager-config.json
{
  "cluster": "mainnet-beta",
  "json_rpc_url": "https://mainnet.helius-rpc.com/?api-key=<api-key>",
  "keypair_path": "/path/to/delegate-keypair.json",
  "priority_fee": { "micro_lamports": 5000 },
  "jupiter_api_key": "<jupiter-api-key>"
}
user-config.json
{
  "cluster": "mainnet-beta",
  "json_rpc_url": "https://mainnet.helius-rpc.com/?api-key=<api-key>",
  "keypair_path": "/path/to/user-keypair.json",
  "priority_fee": { "micro_lamports": 5000 },
  "jupiter_api_key": "<jupiter-api-key>"
}
For convenience, place all user config files, as well as vault setup tokenized.json (see below) in the same directory. All commands, unless specified otherwise, are run from this directory.

Create a Tokenized Vault

glam-cli -C ./owner-config.json vault create ./tokenized.json
Vault setup:
tokenized.json
{
  "state": {
    "accountType": "tokenizedVault"
  },
  "mint": {
    "name": "GLAM Quickstart USDC",
    "symbol": "gqUSD",
    "uri": "",
    "baseAssetMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "maxCap": 1000000000,
    "minSubscription": 1000000,
    "minRedemption": 100000,
    "lockupPeriod": 0,
    "feeStructure": {
      "vault": {
        "subscriptionFeeBps": 0,
        "redemptionFeeBps": 0
      },
      "manager": {
        "subscriptionFeeBps": 0,
        "redemptionFeeBps": 0
      },
      "management": {
        "feeBps": 0
      },
      "performance": {
        "feeBps": 0,
        "hurdleRateBps": 0,
        "hurdleType": "hard"
      }
    },
    "notifyAndSettle": {
      "model": "continuous",
      "permissionlessFulfillment": false,
      "subscribeNoticePeriodType": "soft",
      "subscribeNoticePeriod": 0,
      "subscribeSettlementPeriod": 0,
      "subscribeCancellationWindow": 0,
      "redeemNoticePeriodType": "soft",
      "redeemNoticePeriod": 0,
      "redeemSettlementPeriod": 0,
      "redeemCancellationWindow": 0,
      "timeUnit": "second"
    }
  }
}
The vault setup format may change between CLI versions. See the templates directory for the most up-to-date examples.

Enable Kamino Vaults

Kamino Vaults needs to be enabled before it can be used.
glam-cli -C ./owner-config.json integration enable KaminoVaults

Grant Delegate Permissions

Refer to Integrations and Delegated Accounts for more details on protocols and permissions.
Vault owner grants the delegate the following permissions:
  • Fulfill permission from GlamMint so it can fulfill user requests.
  • Deposit and Withdraw permissions from KaminoVaults so it can deploy GLAM vault assets to Kamino vaults.
glam-cli -C ./owner-config.json delegate grant --protocol GlamMint \
  ndcXmTFuMPkJ5mE4sYNnZdSo99Ajzny88xnrids4QnG Fulfill
glam-cli -C ./owner-config.json delegate grant --protocol KaminoVaults \
  ndcXmTFuMPkJ5mE4sYNnZdSo99Ajzny88xnrids4QnG Deposit Withdraw

Subscribe to GLAM Vault

Set the active GLAM vault to user’s CLI config:
glam-cli -C ./user-config.json vault set 3ciXL6K3kxF754sjqP5acHYHjhZWNK6rj6svjrYouNpY
User subscribes to GLAM vault with 5 USDC:
glam-cli -C ./user-config.json invest subscribe 5
We’ve configured the vault with 0 fees, so user receives 5 shares (initial share price is 1 USDC).

Allocate Idle Capital

User deposited 5 USDC has arrived in the GLAM vault, held by vault PDA. Now the delegate can allocate idle capital to a Kamino vault to start generating yield. Set the active GLAM vault to delegate’s CLI config:
glam-cli -C ./delegate-config.json vault set 3ciXL6K3kxF754sjqP5acHYHjhZWNK6rj6svjrYouNpY
Display vault token balances:
glam-cli -C ./delegate-config.json vault token-balances
Output:
Token        Mint                                          Amount          Value (USD)
SOL          N/A                                           0.000000000     0.000000
USDC         EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v  5               4.999002
Deposit to Kamino vault USDC Prime:
glam-cli -C ./delegate-config.json kamino-vaults \
  deposit HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E 5
Withdraw from Kamino vault USDC Prime:
glam-cli -C ./delegate-config.json kamino-vaults \
  withdraw HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E 3

Redeem GLAM Vault Shares

User holds 5 GLAM vault shares, and redeems 2 shares to get back USDC. Redemption request is queued, and withdrawal amount can be claimed after the request is fulfilled.
glam-cli -C ./user-config.json invest redeem 2

Fulfill Redemption

The delegate has been granted Fulfill permission from GlamMint, so it can fulfill user requests.
glam-cli -C ./delegate-config.json manage fulfill

Claim from Redemption

User claims USDC from fulfilled redemption.
glam-cli -C ./user-config.json invest claim-redemption