I want to have a treasury of usdc for my program. Can a program have its own associated token account, and if so, how does it transfer usdc in and out of the treasury (in Rust)?
Thanks
Solana Stack Exchange is a question and answer site for Solana software users and developers. It only takes a minute to sign up.
Sign up to join this communityI want to have a treasury of usdc for my program. Can a program have its own associated token account, and if so, how does it transfer usdc in and out of the treasury (in Rust)?
Thanks
No. Programs have no way to sign for instructions that require authority, which includes many SPL Token operations. This use case is precisely why PDAs exist.
Programs cannot have an ATA. For this use case, a pool token account can be initialized whose authority is set to a PDA signer. This way, the signer account can sign spl-token transfers out of the pool treasury.