Skip to main content

Overview

The update_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

Option<u16>
Deposit fee rate in basis points (0-10000).
  • 0 = 0% (free deposits)
  • 25 = 0.25%
  • 100 = 1%
  • 1000 = 10%
  • 10000 = 100% (maximum)
Pass None to leave unchanged.
Option<u16>
Withdrawal fee rate in basis points (0-10000).
  • 0 = 0% (free withdrawals)
  • 25 = 0.25% (default)
  • 50 = 0.5%
  • 100 = 1%
  • 10000 = 100% (maximum)
Pass None to leave unchanged.
Option<u16>
Acceptable fee margin in basis points (0-10000). Allows fees to be within a range:
  • 0 = Exact fee required
  • 500 = ±5% (default)
  • 1000 = ±10%
Formula: expected_fee * (1 - margin/10000) <= actual_fee <= expected_feePass None to leave unchanged.

Accounts

Account<GlobalConfig>
required
Global configuration account. PDA: ["global_config"].
  • Mutable: Yes
  • Authority check: Must be owned by the signer
Signer
required
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

With deposit fee rate of 25 basis points (0.25%):
With withdrawal fee rate of 50 basis points (0.5%):
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)
All other fields remain unchanged.

Behavior

  1. Validates each provided fee rate is ≤ 10000 (100%)
  2. Updates only the provided parameters
  3. Emits program log messages for each updated field
  4. Changes apply immediately to all subsequent transactions
Fee changes apply immediately. Ongoing transactions use the fee rates at the time of execution.

Authorization

The signer must be the global config’s authority:

Errors

Error
Thrown when the signer is not the global config’s authority.
Error
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 the initialize instruction:

Best Practices

1

Test fee changes

Test on devnet before updating mainnet configuration.
2

Announce changes

Notify users before making fee changes, especially increases.
3

Set reasonable margins

Use 5-10% error margins to account for precision and rounding.
4

Monitor impact

Track fee collection and transaction volume after changes.

See Also