From 11f5b76dae96b331e67aab10bf73e3da239ccadc Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Sat, 7 Dec 2024 17:08:57 +0700 Subject: [PATCH] Create multi_sig_wallet.rs --- src/stablecoin/src/multi_sig_wallet.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/stablecoin/src/multi_sig_wallet.rs diff --git a/src/stablecoin/src/multi_sig_wallet.rs b/src/stablecoin/src/multi_sig_wallet.rs new file mode 100644 index 0000000..442c7ac --- /dev/null +++ b/src/stablecoin/src/multi_sig_wallet.rs @@ -0,0 +1,26 @@ +// src/multi_sig_wallet.rs +use std::collections::HashSet; + +pub struct MultiSigWallet { + owners: HashSet, + required_signatures: usize, +} + +impl MultiSigWallet { + pub fn new(owners: HashSet, required_signatures: usize) -> Self { + MultiSigWallet { + owners, + required_signatures, + } + } + + pub fn execute_transaction(&self, transaction: &str, signatures: &HashSet) -> bool { + if signatures.len() >= self.required_signatures { + // Execute the transaction + println!("Transaction executed: {}", transaction); + return true; + } + println!("Not enough signatures to execute transaction."); + false + } +}