Skip to main content

Overview

The update_deposit_limit instruction allows the program authority to modify the maximum deposit amount for the SOL merkle tree. For SPL tokens, use update_deposit_limit_for_spl_token instead.
Only the program authority can call this instruction.

Function Signature

Parameters

u64
required
New maximum deposit amount in lamports. Examples:
  • 1 SOL: 1_000_000_000
  • 100 SOL: 100_000_000_000
  • 1,000 SOL: 1_000_000_000_000 (default)
  • 10,000 SOL: 10_000_000_000_000

Accounts

AccountLoader<MerkleTreeAccount>
required
The merkle tree account to update. PDA: ["merkle_tree"].
  • Mutable: Yes
  • Authority check: Must be owned by the signer
Signer
required
The program authority. Must match the tree’s authority field.
  • Signer: Yes

Code Example

Update SPL Token Deposit Limit

For SPL tokens, use the separate instruction with the mint-specific PDA:

Common Use Cases

When transaction volume increases, raise the limit to accommodate larger deposits:
During security incidents or maintenance, lower the limit to reduce risk:
Set limit to 0 to prevent all new deposits:

State Changes

MerkleTreeAccount

  • max_deposit_amount: Updated to new_limit
All other fields remain unchanged.

Behavior

  1. Loads the tree account and verifies authority
  2. Updates the max_deposit_amount field
  3. Emits a program log message
  4. The new limit applies immediately to all subsequent deposits
Existing deposits are not affected. Only new deposits will be subject to the new limit.

Authorization

The signer must be the tree’s authority. This is verified through Anchor’s has_one constraint:

Errors

Error
Thrown when the signer is not the tree’s authority.

Program Log Output

When successful, the instruction logs:
For SPL tokens:

Monitoring Limit Changes

You can monitor limit changes by:
  1. Parsing transaction logs for “Deposit limit updated” messages
  2. Periodically fetching the tree account and checking max_deposit_amount
  3. Setting up event listeners for authority transactions

See Also