Skip to main content

lumos_svm_lib/schema/
program_config.rs

1use serde::Deserialize;
2
3use crate::lumos_context::LumosContext;
4use crate::traits::Pull;
5use crate::utils::clone_program;
6
7/// The program configuration definition.
8#[derive(Debug, Deserialize)]
9pub struct ProgramConfig {
10  /// The public key address of the program.
11  pub address: String,
12
13  /// Set the authority of the program for upgradability.
14  pub authority: Option<String>,
15
16  /// Check if the program should be updated.
17  pub update: Option<bool>,
18}
19
20impl Pull for ProgramConfig {
21  /// Pull the program.
22  fn pull(&self, context: &LumosContext) -> anyhow::Result<()> {
23    let update = self.update.unwrap_or(false);
24    clone_program(context, &self.address, update)
25  }
26
27  /// Get the address of the program.
28  fn address(&self) -> &str {
29    &self.address
30  }
31}