The fees sub-client manages fee operations for tokenized vaults, including crystallization, claiming, and protocol fee configuration.
For an overview of the fee structure, see Fees.
Fee Lifecycle
Fees in GLAM tokenized vaults follow a three-step lifecycle:
- Accrue — Fees accumulate based on the vault’s fee structure (management, performance, subscription, redemption)
- Crystallize — Accrued fees are calculated and recorded onchain
- Claim — Crystallized fees are transferred to the manager and protocol
Crystallize Fees
Crystallize accrued management and performance fees. This must be called before claiming:
import { GlamClient } from "@glamsystems/glam-sdk";
const glamClient = new GlamClient();
const txSig = await glamClient.fees.crystallizeFees();
Crystallization triggers vault pricing internally. The vault must have up-to-date price data for accurate fee calculation.
Claim Fees
Claim crystallized fees. Fees are distributed to the vault manager and the protocol:
const txSig = await glamClient.fees.claimFees();
Query Fees
Get Claimable Fees
View fees that have been crystallized and are ready to claim:
const claimable = await glamClient.fees.getClaimableFees();
Get Claimed Fees
View the history of fees that have already been claimed:
const claimed = await glamClient.fees.getClaimedFees();
Set Protocol Fees
Configure protocol-level fee rates (requires protocol authority):
await glamClient.fees.setProtocolFees(
1, // baseFeeBps (basis points)
2000, // flowFeeBps (basis points)
);