Overview
GLAM vaults interact with external DeFi protocols through a secure integration system. Each integration must be explicitly enabled and can be configured with protocol-specific policies.Integration Architecture
GLAM uses a modular integration system:Integration Programs
Integration programs are GLAM-developed adapters that provide safe access to external protocols:- Protocol Program: Core DeFi integrations (swaps, staking, transfers)
- Ext Drift Program: Drift Protocol derivatives and spot trading
- Ext Kamino Program: Kamino lending, vaults, and farms
Integration programs cannot be added by users. They are developed and audited by the GLAM team to ensure security and correctness.
Protocol Bitflags
Each integration program supports multiple protocols, represented as bitflags: Protocol Program:0b0000001(1) - SplToken: SPL token operations0b0000010(2) - Transfer: Cross-program transfers0b0000100(4) - JupiterSwap: Token swaps via Jupiter aggregator0b0001000(8) - Stake: Native SOL staking0b0010000(16) - Marinade: Marinade Finance liquid staking0b0100000(32) - LST: Generic liquid staking token support
0b01(1) - DriftProtocol: Spot and perpetual trading
0b01(1) - KaminoLend: Lending and borrowing0b10(2) - KaminoVaults: Automated liquidity vaults0b100(4) - KaminoFarms: Liquidity mining farms
Bitflags can be combined using bitwise OR. For example, enabling both JupiterSwap (0b0000100) and Stake (0b0001000) results in 0b0001100 (12).
Available Protocols
SPL Token
Protocol:SplTokenIntegration: Protocol Program
Bitflag:
0b0000001
Capabilities:
- Burn tokens from vault
- Mint tokens to vault
- Transfer tokens between accounts
BurnMintTransfer
Jupiter Swap
Protocol:JupiterSwapIntegration: Protocol Program
Bitflag:
0b0000100
Capabilities:
- Swap tokens using Jupiter aggregator
- Access best prices across Solana DEXes
- Configure slippage limits and token allowlists
Swap
Drift Protocol
Protocol:DriftProtocolIntegration: Ext Drift Program
Bitflag:
0b01
Capabilities:
- Trade spot markets
- Trade perpetual futures
- Manage collateral deposits
- Place, modify, and cancel orders
Initialize- Initialize Drift accountsDeposit- Deposit collateralWithdraw- Withdraw collateralPlaceOrder- Place spot/perp ordersCancelOrder- Cancel existing ordersModifyOrder- Modify order parameters
Kamino Lend
Protocol:KaminoLendIntegration: Ext Kamino Program
Bitflag:
0b01
Capabilities:
- Deposit assets to lending markets
- Withdraw deposited assets
- Borrow against collateral
- Repay borrowed assets
DepositWithdrawBorrowRepay
Kamino Vaults
Protocol:KaminoVaultsIntegration: Ext Kamino Program
Bitflag:
0b10
Capabilities:
- Deposit to automated liquidity vaults
- Withdraw from vaults
- Earn automated yield from concentrated liquidity
Kamino Farms
Protocol:KaminoFarmsIntegration: Ext Kamino Program
Bitflag:
0b100
Capabilities:
- Stake LP tokens in liquidity mining farms
- Claim farming rewards
- Unstake LP tokens
Native Staking
Protocol:StakeIntegration: Protocol Program
Bitflag:
0b0001000
Capabilities:
- Stake SOL to validators
- Delegate to stake pools
- Unstake and withdraw
Marinade Finance
Protocol:MarinadeIntegration: Protocol Program
Bitflag:
0b0010000
Capabilities:
- Liquid stake SOL for mSOL
- Unstake mSOL for SOL
- Earn staking yields while maintaining liquidity
Managing Integrations
Listing Integrations
View all enabled integrations for the active vault:Enabling Protocols
Enable one or more protocols by name:- Groups protocols by integration program
- Computes combined bitflag for each program
- Submits transaction to enable protocols
- Updates integration ACLs on-chain
Protocol Grouping
Protocol Grouping
When enabling multiple protocols, the CLI automatically groups them by integration program:This creates three transactions:
- Enable JupiterSwap (0b0000100) on Protocol Program
- Enable DriftProtocol (0b01) on Ext Drift Program
- Enable KaminoLend (0b01) on Ext Kamino Program
Disabling Protocols
Disable specific protocols:Disabling All Protocols from Integration
Completely disable an integration program:- Removes all protocols from the integration program
- Uses
emergencyAccessUpdatefor immediate effect - Prevents all operations through that integration
- Blocks delegate access to those protocols
Integration Validation
For any vault operation through an integration, GLAM validates:- Integration enabled: Integration program is in vault’s integration ACL
- Protocol enabled: Protocol bitflag is set in integration’s protocols bitmask
- Policy compliance: Operation complies with protocol policy (if configured)
- Permission granted: Signer has required permissions (owner or delegate)
Protocol Policies
Some protocols support additional policy configurations:Policy Purpose
Policies add an extra layer of risk control:- Slippage limits: Prevent excessive losses from price impact
- Asset allowlists: Restrict trading to approved tokens
- Market allowlists: Limit exposure to specific markets
- Borrowing limits: Control which assets can be borrowed
Policy Structure
Policies are stored on-chain in the vault state account:Setting Policies
Each protocol has specific commands for policy management: Jupiter:Policies are optional. If no policy is set, the protocol uses default behavior (e.g., Jupiter allows all tokens, Drift allows all markets).
Integration vs Delegate Permissions
Integrations and delegates work together to control vault access:| Aspect | Integration ACL | Delegate ACL |
|---|---|---|
| Controls | Which protocols are available | Who can use protocols |
| Managed by | Vault owner | Vault owner |
| Scope | Vault-wide | Per-delegate |
| Granularity | Per-protocol | Per-permission |
Without step 3, the delegate cannot swap (permission not granted).
Step 2 is optional but recommended for risk management.
Best practice: Enable integrations minimally, set restrictive policies, and grant delegate permissions sparingly.
Use Cases
Conservative Yield Strategy
Aggressive Trading Strategy
Multi-Protocol Portfolio
Best Practices
Enable Minimally
Only enable protocols you actively use:Configure Policies
Use protocol policies to limit risk:Regular Audits
Periodically review enabled integrations:Emergency Disabling
Quickly disable protocols during incidents:Test Before Production
Test integrations on devnet before enabling on mainnet:Technical Details
Integration ACL Storage
From integration.ts:61-76, integration ACLs are stored as:Bitflag Operations
From integration.ts:25-44, protocol resolution:- Map protocol name to integration program and bitflag
- Group protocols by integration program
- Combine bitflags using OR:
bitmask |= protocolBitflag - Submit combined bitmask to enable/disable protocols
Cross-Program Invocations (CPI)
Integration programs use Solana’s CPI mechanism to interact with external protocols:- Vault always maintains custody of assets
- External protocols cannot directly access vault
- GLAM validates all operations before CPI
- Failed operations don’t compromise vault state
All GLAM integrations are open-source and audited. Review the integration programs at github.com/glamsystems before enabling.