Overview
Theupdate_global_config instruction allows the program authority to modify the global fee settings that apply to all SOL and SPL token transactions.
Fees are specified in basis points (1 basis point = 0.01%).
Only the program authority can call this instruction. At least one parameter must be provided.
Function Signature
Parameters
Deposit fee rate in basis points (0-10000).
0= 0% (free deposits)25= 0.25%100= 1%1000= 10%10000= 100% (maximum)
None to leave unchanged.Withdrawal fee rate in basis points (0-10000).
0= 0% (free withdrawals)25= 0.25% (default)50= 0.5%100= 1%10000= 100% (maximum)
None to leave unchanged.Acceptable fee margin in basis points (0-10000). Allows fees to be within a range:
0= Exact fee required500= ±5% (default)1000= ±10%
expected_fee * (1 - margin/10000) <= actual_fee <= expected_feePass None to leave unchanged.Accounts
Global configuration account. PDA:
["global_config"].- Mutable: Yes
- Authority check: Must be owned by the signer
The program authority. Must match the global_config’s authority field.
- Signer: Yes
Code Examples
Update Withdrawal Fee
Update All Fee Settings
Make Deposits Free
Fee Calculation Examples
Deposit Fee Calculation
Deposit Fee Calculation
With deposit fee rate of 25 basis points (0.25%):
Withdrawal Fee Calculation
Withdrawal Fee Calculation
With withdrawal fee rate of 50 basis points (0.5%):
Fee Error Margin
Fee Error Margin
With error margin of 500 basis points (5%):
Basis Points Reference
Common Fee Rates
- 0 = 0% (free)
- 1 = 0.01%
- 10 = 0.1%
- 25 = 0.25%
- 50 = 0.5%
- 100 = 1%
- 250 = 2.5%
- 500 = 5%
- 1000 = 10%
Fee Error Margins
- 0 = No margin (exact)
- 100 = ±1%
- 500 = ±5%
- 1000 = ±10%
- 2000 = ±20%
State Changes
GlobalConfig
deposit_fee_rate: Updated if provided (otherwise unchanged)withdrawal_fee_rate: Updated if provided (otherwise unchanged)fee_error_margin: Updated if provided (otherwise unchanged)
Behavior
- Validates each provided fee rate is ≤ 10000 (100%)
- Updates only the provided parameters
- Emits program log messages for each updated field
- Changes apply immediately to all subsequent transactions
Authorization
The signer must be the global config’s authority:Errors
Thrown when the signer is not the global config’s authority.
Thrown when any fee rate parameter exceeds 10000 (100%).
Program Log Output
When successful, the instruction logs each updated field:Reading Current Configuration
Default Configuration
Initialized by theinitialize instruction:
Best Practices
See Also
- initialize - Set initial fee configuration
- transact - How fees apply to SOL transactions
- transact_spl - How fees apply to SPL transactions