From 9b91546652a6ac1283102748c39c3e48bc5f5aec Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Mon, 8 Apr 2024 00:15:36 +0300 Subject: [PATCH] multisig interactor minor refactor --- .../multisig/interact/src/multisig_interact.rs | 7 +++++++ .../multisig/interact/src/multisig_interact_nfts.rs | 10 ++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/contracts/examples/multisig/interact/src/multisig_interact.rs b/contracts/examples/multisig/interact/src/multisig_interact.rs index 62074b08a8..65b6c0dbb1 100644 --- a/contracts/examples/multisig/interact/src/multisig_interact.rs +++ b/contracts/examples/multisig/interact/src/multisig_interact.rs @@ -352,6 +352,13 @@ impl MultisigInteract { println!("successfully performed sign action `{action_ids:?}`"); } + async fn sign_if_quorum_not_reached(&mut self, action_id: usize) { + if !self.quorum_reached(action_id).await { + self.sign(&[action_id]).await; + } + println!("quorum reached for action `{action_id}`"); + } + async fn dns_register(&mut self, name: &str) { let dns_address = dns_address_for_name(name); self.interactor diff --git a/contracts/examples/multisig/interact/src/multisig_interact_nfts.rs b/contracts/examples/multisig/interact/src/multisig_interact_nfts.rs index e15000bc4c..61788f99af 100644 --- a/contracts/examples/multisig/interact/src/multisig_interact_nfts.rs +++ b/contracts/examples/multisig/interact/src/multisig_interact_nfts.rs @@ -71,10 +71,7 @@ impl MultisigInteract { println!("perfoming issue collection with all roles action `{action_id}`..."); - if !self.quorum_reached(action_id).await { - self.sign(&[action_id]).await; - } - println!("quorum reached for action `{action_id}`"); + self.sign_if_quorum_not_reached(action_id).await; let new_token_id = self .interactor @@ -127,10 +124,7 @@ impl MultisigInteract { println!("perfoming issue collection action `{action_id}`..."); - if !self.quorum_reached(action_id).await { - self.sign(&[action_id]).await; - } - println!("quorum reached for action `{action_id}`"); + self.sign_if_quorum_not_reached(action_id).await; let new_token_id = self .interactor