Overview
TheTreeTokenAccount is a Program Derived Address (PDA) that serves as the custody account for native SOL in the Privacy Cash protocol. All SOL deposits are transferred to this account, and all SOL withdrawals are paid from it.
Account Structure
The public key of the authority that can update this account’s configuration
The PDA bump seed used for account derivation
PDA Seeds
Usage
Deposits
When users deposit SOL:- User transfers SOL from their wallet to the
TreeTokenAccount - The deposit amount is validated against the
max_deposit_amountlimit - Commitment is added to the Merkle tree
Withdrawals
When users withdraw SOL:- User provides a valid zero-knowledge proof
- SOL is transferred from
TreeTokenAccountto the recipient - Fees (if any) are transferred from
TreeTokenAccountto the fee recipient - The account must maintain rent-exempt balance
Notes
- This account is used only for native SOL, not SPL tokens
- For SPL tokens, Associated Token Accounts (ATAs) are used instead
- The account is a PDA, meaning it has no private key and can only be controlled by the program
- Transfers from this account use
try_borrow_mut_lamports()to directly modify lamport balances - The account must always maintain enough lamports to remain rent-exempt