Follow the steps in the CLI introduction to install and configure the GLAM CLI.
All transactions mentioned in this quickstart were executed on devnet.
Preparation
In this quickstart, there are three personas:
- Vault owner: creates a vault, configures it
- Manager: fulfills investor requests
- User: subscribes to the vault, and redeems shares
Prepare a CLI config file for each persona:
{
"cluster": "devnet",
"json_rpc_url": "https://devnet.helius-rpc.com/?api-key=<helius-api-key>",
"keypair_path": "/path/to/owner-keypair.json",
"priority_fee": {
"micro_lamports": 10000
}
}
{
"cluster": "devnet",
"json_rpc_url": "https://devnet.helius-rpc.com/?api-key=<helius-api-key>",
"keypair_path": "/path/to/manager-keypair.json",
"priority_fee": {
"micro_lamports": 10000
}
}
{
"cluster": "devnet",
"json_rpc_url": "https://devnet.helius-rpc.com/?api-key=<helius-api-key>",
"keypair_path": "/path/to/user-keypair.json",
"priority_fee": {
"micro_lamports": 10000
}
}
Create a Vault
$ glam-cli -C ./owner-config.json vault create ./tokenized.json
GLAM tokenized vault initialized: 5hK697Y3YShBo7aQFgXWHM78TufmLuWkCSJWBJrkZqgkMyGVQ922k8PqBEReNhoENwp6rK6KR6zgnXe8nMYqPKPq
State PDA: Do7ATc7i6aYaWm8yNRL2i3FzuXp42pSsdYrwiedmS8nA
Vault PDA: DaUbFgnbZGw47KgdRj3Sr7j47Tqz6jVteNzASfDEegGb
Mint PDA: GYjsoXr4fWdYzqt6kF5awDYuFn6oBRKtomL8fDVGqsG7
Vault setup:
{
"state": {
"accountType": "tokenizedVault",
"enabled": true
},
"mint": {
"name": "GLAM Quickstart (SOL)",
"symbol": "gqSOL",
"baseAssetMint": "So11111111111111111111111111111111111111112",
"maxCap": 1000000000000,
"minSubscription": 100000000,
"minRedemption": 100000000,
"lockupPeriod": 0,
"feeStructure": {
"vault": {
"subscriptionFeeBps": 10,
"redemptionFeeBps": 10
},
"manager": {
"subscriptionFeeBps": 0,
"redemptionFeeBps": 0
},
"management": {
"feeBps": 0
},
"performance": {
"feeBps": 2000,
"hurdleRateBps": 5,
"hurdleType": "hard"
}
},
"notifyAndSettle": {
"model": "continuous",
"permissionlessFulfillment": false,
"subscribeNoticePeriodType": "soft",
"subscribeNoticePeriod": 0,
"subscribeSettlementPeriod": 0,
"subscribeCancellationWindow": 0,
"redeemNoticePeriodType": "soft",
"redeemNoticePeriod": 0,
"redeemSettlementPeriod": 0,
"redeemCancellationWindow": 0,
"timeUnit": "slot"
}
}
}
Grant Manager Permissions
Grant manager key fulfill
permission (bitflag 32) so it can fulfill investor requests. Refer to Integrations and Delegated Accounts for more details on protocol bitflags and permission bitflags.
$ glam-cli -C ./owner-config.json delegate grant 94ayC6xWvsaMFBJf4RysAodSmakxEnnHtqYD14tV8Eo3 GM1NtvvnSXUptTrMCqbogAdZJydZSNv98DoU5AZVLmGh 1 32
Granted 94ayC6xWvsaMFBJf4RysAodSmakxEnnHtqYD14tV8Eo3 permissions 0000000000100000 to GM1NtvvnSXUptTrMCqbogAdZJydZSNv98DoU5AZVLmGh for protocol 0000000000000001: kWaSudrNhvgRH4r8du7kPeKQ3s7xvVekf5aW9zrsC4euTsnxEZEgKw2hqLUdvFuK9ahpoZbrxKktsmZ5DRLobDk
Subscribe to the Vault
Set the active vault to user’s CLI config:
$ glam-cli -C ./user-config.json vault set Do7ATc7i6aYaWm8yNRL2i3FzuXp42pSsdYrwiedmS8nA
Subscribe to the vault with 1 SOL:
$ glam-cli -C ./user-config.json invest subscribe 1
7uJURQ1ZkD1uptac8PyajR2DUTyEqiAjXTUjQ3YhGQ6c instant subscription: AJR5ioYARCpTXfPt79CqvVJdz5CYTctrPXQH5q4f17U5LuujRGtbKAgginBDxyqT6GrnFwof8p2ny4hBnoFB9is
Due to entry fee, user receives less than 0.999 share.
Redeem Vault Shares
Redemption is queued and needs to be fulfilled by the manager.
$ glam-cli -C ./user-config.json invest redeem 0.999
? Confirm queued redemption of 0.999 shares? Yes
7uJURQ1ZkD1uptac8PyajR2DUTyEqiAjXTUjQ3YhGQ6c requested to redeem: 3su8o2YQVb86sC4nvtzMaHofUJoSpEPMmQLnz9dY39aJmifWxbhk3gcrYUhdhJKKFvWdDt8eRqkjqhKU5UQsAYED
Fulfill Redemption
$ glam-cli -C ./manager-config.json manage fulfill
94ayC6xWvsaMFBJf4RysAodSmakxEnnHtqYD14tV8Eo3 triggered fulfillment: 36UgC1Da8M4QpkZPcN9eByum5nhNCaEJyfja2LdyVq8yW6YNm4YkPiDxg1t5XyFBHkbwzar9Cj42jQqxzcSH3fa7
Claim from Redemption
$ glam-cli -C ./user-config.json invest claim-redemption
7uJURQ1ZkD1uptac8PyajR2DUTyEqiAjXTUjQ3YhGQ6c claimed tokens: 3k8kkcW9wC1qhs4pW8RZTgjrQHjcVmvd8ajGaVU4t9vbZiG1mqyPEj9L29SvN5TBszjN53DxwvAwLiWTxFWMZnrv
Claim Fees
$ glam-cli -C ./owner-config.json manage claim-fees
HYqnQD1MRXYe93RSGmex2hG85cCndkmCjBVf7MHodiRB claimed fees: xy8jYTkKjZ2mvyWNFkUpZAy3PAzwo19kyteaCtLL8r4QWn9UD6z8iVGH957WF2RFLvGnjJYEPJpUqPXSgtJZeH4