mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
track DAO keypair
This commit is contained in:
@@ -257,6 +257,7 @@ pub async fn demo() -> Result<()> {
|
||||
/////////////////////////////////////////////////////
|
||||
////// Create the DAO bulla
|
||||
/////////////////////////////////////////////////////
|
||||
debug!(target: "demo", "1. Creating DAO bulla");
|
||||
|
||||
//// Wallet
|
||||
|
||||
@@ -308,6 +309,10 @@ pub async fn demo() -> Result<()> {
|
||||
//// Mint the initial supply of treasury token
|
||||
//// and send it all to the DAO directly
|
||||
///////////////////////////////////////////////////
|
||||
debug!(target: "demo", "2. Minting treasury token");
|
||||
|
||||
let state = states.lookup_mut::<money_contract::State>(&"Money".to_string()).unwrap();
|
||||
state.wallet_cache.track(dao_keypair.secret);
|
||||
|
||||
//// Wallet
|
||||
|
||||
@@ -399,6 +404,7 @@ pub async fn demo() -> Result<()> {
|
||||
//// Mint the governance token
|
||||
//// Send it to three hodlers
|
||||
///////////////////////////////////////////////////
|
||||
debug!(target: "demo", "3. Minting governance token");
|
||||
|
||||
//// Wallet
|
||||
|
||||
@@ -534,6 +540,7 @@ pub async fn demo() -> Result<()> {
|
||||
// In order to make a valid vote, first the proposer must
|
||||
// meet a criteria for a minimum number of gov tokens
|
||||
///////////////////////////////////////////////////
|
||||
debug!(target: "demo", "4. Propose the vote");
|
||||
|
||||
//// Wallet
|
||||
|
||||
|
||||
@@ -33,11 +33,13 @@ impl WalletCache {
|
||||
Self { cache: Vec::new() }
|
||||
}
|
||||
|
||||
/// Must be called at the start to begin tracking received coins for this secret.
|
||||
pub fn track(&mut self, secret: SecretKey) {
|
||||
self.cache.push((secret, Vec::new()));
|
||||
}
|
||||
|
||||
/// Get all coins received by this secret key
|
||||
/// track() must be called on this secret before calling this or the function will panic.
|
||||
pub fn get_received(&mut self, secret: &SecretKey) -> Vec<OwnCoin> {
|
||||
for (other_secret, own_coins) in self.cache.iter_mut() {
|
||||
if *secret == *other_secret {
|
||||
@@ -45,7 +47,7 @@ impl WalletCache {
|
||||
return std::mem::replace(own_coins, Vec::new())
|
||||
}
|
||||
}
|
||||
unreachable!();
|
||||
panic!("you forget to track() this secret!");
|
||||
}
|
||||
|
||||
pub fn try_decrypt_note(
|
||||
|
||||
@@ -129,7 +129,7 @@ pub fn state_transition(
|
||||
nullifiers.push(input.revealed.nullifier);
|
||||
}
|
||||
|
||||
debug!(target: TARGET, "Verifying zk proofs");
|
||||
debug!(target: TARGET, "Verifying call data");
|
||||
match call_data.verify(&func_call.proofs) {
|
||||
Ok(()) => {
|
||||
debug!(target: TARGET, "Verified successfully")
|
||||
|
||||
Reference in New Issue
Block a user