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
Preparation
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:
{
"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 }
}
{
"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 }
}
{
"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 }
}
For convenience, place all 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:
{
"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"
}
}
}
See all 46 lines
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
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 balances:
glam-cli -C ./delegate-config.json vault 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