ctor.rs 1.1 KB

1234567891011121314151617181920212223242526272829
  1. use crate::{Accounts, Sysvar};
  2. use solana_program::account_info::AccountInfo;
  3. use solana_program::sysvar::rent::Rent;
  4. // The Ctor accounts that can be used to create any account within the program
  5. // itself (instead of creating the account on the client).
  6. //
  7. // This is used to create accounts at deterministic addresses, as a function of
  8. // nothing but a program ID--for example, to create state global program
  9. // structs and program IDL accounts.
  10. #[derive(Accounts)]
  11. pub struct Ctor<'info> {
  12. // Payer of the transaction.
  13. #[account(signer)]
  14. pub from: AccountInfo<'info>,
  15. // The deterministically defined "state" account being created via
  16. // `create_account_with_seed`.
  17. #[account(mut)]
  18. pub to: AccountInfo<'info>,
  19. // The program-derived-address signing off on the account creation.
  20. // Seeds = &[] + bump seed.
  21. pub base: AccountInfo<'info>,
  22. // The system program.
  23. pub system_program: AccountInfo<'info>,
  24. // The program whose state is being constructed.
  25. pub program: AccountInfo<'info>,
  26. // Rent sysvar.
  27. pub rent: Sysvar<'info, Rent>,
  28. }