Skip to content

Commit

Permalink
test passing
Browse files Browse the repository at this point in the history
  • Loading branch information
petersalomonsen committed Jan 5, 2025
1 parent 79b6355 commit 88a1b9d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
Binary file modified sputnikdao-factory2/res/sputnikdao_factory2.wasm
Binary file not shown.
2 changes: 0 additions & 2 deletions sputnikdao-factory2/src/factory_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,8 @@ impl FactoryManager {
env::promise_batch_action_create_account(promise_id);
// Transfer attached deposit.
env::promise_batch_action_transfer(promise_id, attached_deposit);
env::log_str("checking key");
if let Some(public_key) = public_key {
// Add passed public key
env::log_str(format!("Adding key {:?}", public_key.as_str()).as_str());
env::promise_batch_action_add_key_with_full_access(promise_id, &PublicKey::from_str(public_key.as_str()).unwrap(), 0);
}

Expand Down
16 changes: 6 additions & 10 deletions sputnikdao-factory2/tests/test_basics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ async fn test_factory() -> Result<(), Box<dyn std::error::Error>> {

assert!(create_result.is_success());

println!("{:?}", create_result);
println!(
"public key {}",
user_account.secret_key().public_key().to_string()
);
let dao_account_id: AccountId = format!("{}.{}", dao_name, SPUTNIKDAO_FACTORY_CONTRACT_ACCOUNT).parse().unwrap();
let dao_contract = Contract::from_secret_key(
dao_account_id.clone(),
Expand All @@ -129,14 +124,15 @@ async fn test_factory() -> Result<(), Box<dyn std::error::Error>> {
assert_eq!(create_dao_args["config"], config);

let user_account_status_before_delete = user_account.view_account().await?;
assert_eq!(user_account_status_before_delete.balance, NearToken::from_yoctonear(93984722284196139773822472));
assert_eq!(user_account_status_before_delete.balance.as_near(), account_details_before.balance.saturating_sub(NearToken::from_near(7)).as_near());

let delete_result = dao_contract.delete_contract(user_account.id()).await?;
assert!(delete_result.is_success());
println!("{:?}", delete_result);

worker.fast_forward(10).await?;

let user_account_status_after_delete = user_account.view_account().await?;
assert_eq!(user_account_status_after_delete.balance, account_details_before.balance);
assert_eq!(user_account_status_after_delete.balance.as_near(), account_details_before.balance.saturating_sub(NearToken::from_near(1)).as_near());

Ok(())
}

0 comments on commit 88a1b9d

Please sign in to comment.