From 0a47b538d5463196f0d4f9bfd18e00247a3d1a0d Mon Sep 17 00:00:00 2001 From: Jake Hartnell Date: Fri, 18 Aug 2023 16:45:45 -0700 Subject: [PATCH] Clean up code comments from #724 --- contracts/voting/dao-voting-native-staked/src/hooks.rs | 1 - .../voting/dao-voting-token-factory-staked/src/contract.rs | 7 +++++-- .../voting/dao-voting-token-factory-staked/src/hooks.rs | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/contracts/voting/dao-voting-native-staked/src/hooks.rs b/contracts/voting/dao-voting-native-staked/src/hooks.rs index 5867d8ff4..a04d3b043 100644 --- a/contracts/voting/dao-voting-native-staked/src/hooks.rs +++ b/contracts/voting/dao-voting-native-staked/src/hooks.rs @@ -2,7 +2,6 @@ use crate::state::HOOKS; use cosmwasm_schema::cw_serde; use cosmwasm_std::{to_binary, Addr, StdResult, Storage, SubMsg, Uint128, WasmMsg}; -// This is just a helper to properly serialize the above message #[cw_serde] pub enum StakeChangedHookMsg { Stake { addr: Addr, amount: Uint128 }, diff --git a/contracts/voting/dao-voting-token-factory-staked/src/contract.rs b/contracts/voting/dao-voting-token-factory-staked/src/contract.rs index 8fd8767e4..1d434bf24 100644 --- a/contracts/voting/dao-voting-token-factory-staked/src/contract.rs +++ b/contracts/voting/dao-voting-token-factory-staked/src/contract.rs @@ -624,11 +624,14 @@ pub fn reply( let mut mint_msgs: Vec = vec![]; - // Check supply is greater than zero + // Check supply is greater than zero, iterate through initial + // balances and sum them. let initial_supply = token .initial_balances .iter() - .fold(Uint128::zero(), |p, n| p + n.amount); + .fold(Uint128::zero(), |previous, new_balance| { + previous + new_balance.amount + }); // Cannot instantiate with no initial token owners because it would // immediately lock the DAO. diff --git a/contracts/voting/dao-voting-token-factory-staked/src/hooks.rs b/contracts/voting/dao-voting-token-factory-staked/src/hooks.rs index 08feaac60..b5941ce84 100644 --- a/contracts/voting/dao-voting-token-factory-staked/src/hooks.rs +++ b/contracts/voting/dao-voting-token-factory-staked/src/hooks.rs @@ -3,7 +3,6 @@ use cosmwasm_schema::cw_serde; use cosmwasm_std::{to_binary, Addr, StdResult, Storage, SubMsg, Uint128, WasmMsg}; use token_bindings::TokenFactoryMsg; -// This is just a helper to properly serialize the above message #[cw_serde] pub enum StakeChangedHookMsg { Stake { addr: Addr, amount: Uint128 },