2 Comments

Is this really working? SystemAccount means `SystemAccount.info.owner == SystemProgram`. So, how can you then debit lamports with your program from a System owned account? I've implemented the example and it's not working, failing with `Transaction simulation failed: Error processing Instruction 0: instruction spent from the balance of an account it does not own`

Expand full comment
author

Hey Dan! Here, the Cross-Program Invocation (CPI) context, created with the CpiContext::new_with_signer method, enables the program to perform operations such as transferring lamports, even though the vault is a SystemAccount. This works because the PDA, derived from the signer seeds, effectively signs the transaction on behalf of the vaultI. The error you encountered might stem from incorrect PDA derivation or signer seeds. Double-check those, and it should work fine. Happy to assist further!

Expand full comment