From 6d20612f2c0656c9bbe752ce0cbd13421f13227a Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Fri, 29 Dec 2023 16:20:55 -0600 Subject: [PATCH] output the iterated values (#71) --- contracts/sei-tester/src/contract.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contracts/sei-tester/src/contract.rs b/contracts/sei-tester/src/contract.rs index b3a5986..0978a61 100644 --- a/contracts/sei-tester/src/contract.rs +++ b/contracts/sei-tester/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::{ coin, entry_point, to_binary, BankMsg, Binary, Coin, Decimal, Deps, DepsMut, Env, MessageInfo, - Reply, Response, StdError, StdResult, SubMsg, SubMsgResponse, Uint128, Order as IteratorOrder + Reply, Response, StdError, StdResult, SubMsg, SubMsgResponse, Uint128, Order as IteratorOrder, Attribute }; use cw_storage_plus::Bound; @@ -100,14 +100,17 @@ fn test_occ_iterator_range( IteratorOrder::Ascending ).collect::, StdError>>().unwrap(); - for (_, val) in values { + let mut value_attrs: Vec = vec![]; + for (key, val) in values { sum += val; + value_attrs.push(Attribute::new(key.to_string(), val.to_string())); } USER_SUMS.save(deps.storage, info.sender.clone(), &sum)?; Ok(Response::new() .add_attribute("user", info.sender.to_string()) .add_attribute("sum", sum.to_string()) + .add_attributes(value_attrs) ) }