Skip to content

Commit

Permalink
chore: added more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Nov 12, 2024
1 parent ee6402d commit 8fae32d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/deploy/src/adodb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,21 @@ pub fn deploy(
) -> Result<(), DeployError> {
let chain = get_chain(chain);
let daemon = DaemonBuilder::new(chain.clone()).build().unwrap();

log::info!("Setting kernel address to {}", kernel_address);
let kernel = KernelContract::new(daemon.clone());
kernel.set_address(&Addr::unchecked(kernel_address.clone()));

log::info!("Setting ADODB address to {}", kernel_address);
let adodb = ADODBContract::new(daemon.clone());
let adodb_addr = kernel.key_address("adodb")?;
adodb.set_address(&adodb_addr);

log::info!("Getting all contracts");
let all_contracts = all_contracts();

let contracts_to_deploy = contracts.unwrap_or_default();
log::info!("Checking for invalid contracts");
let invalid_contracts = contracts_to_deploy
.iter()
.filter(|name| !all_contracts.iter().any(|(n, _, _)| &n == name))
Expand All @@ -36,6 +41,7 @@ pub fn deploy(
.unwrap();
}

log::info!("Filtering valid contracts");
let valid_contracts = contracts_to_deploy
.iter()
.filter(|name| all_contracts.iter().any(|(n, _, _)| &n == name))
Expand All @@ -46,13 +52,14 @@ pub fn deploy(
.send()
.unwrap();

log::info!("Deploying contracts");
let mut deployed_contracts: Vec<(String, String, u64)> = vec![];
for (name, version, upload) in all_contracts {
if !contracts_to_deploy.is_empty() && !contracts_to_deploy.contains(&name) {
continue;
}

println!("Deploying {} {}", name, version);
log::info!("Deploying {} {}", name, version);
let code_id = upload(&daemon)?;
adodb.publish(name.clone(), code_id, version.clone(), None, None)?;
deployed_contracts.push((name, version, code_id));
Expand Down

0 comments on commit 8fae32d

Please sign in to comment.