Skip to content

Commit

Permalink
Create multi_sig_wallet.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Dec 7, 2024
1 parent fd18d56 commit 11f5b76
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/stablecoin/src/multi_sig_wallet.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// src/multi_sig_wallet.rs
use std::collections::HashSet;

pub struct MultiSigWallet {
owners: HashSet<String>,
required_signatures: usize,
}

impl MultiSigWallet {
pub fn new(owners: HashSet<String>, required_signatures: usize) -> Self {
MultiSigWallet {
owners,
required_signatures,
}
}

pub fn execute_transaction(&self, transaction: &str, signatures: &HashSet<String>) -> bool {
if signatures.len() >= self.required_signatures {
// Execute the transaction
println!("Transaction executed: {}", transaction);
return true;
}
println!("Not enough signatures to execute transaction.");
false
}
}

0 comments on commit 11f5b76

Please sign in to comment.