Skip to content

Commit

Permalink
output the iterated values (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
udpatil authored Dec 29, 2023
1 parent 1b0c603 commit 6d20612
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions contracts/sei-tester/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(not(feature = "library"))]
use cosmwasm_std::{
coin, entry_point, to_binary, BankMsg, Binary, Coin, Decimal, Deps, DepsMut, Env, MessageInfo,

Check warning on line 3 in contracts/sei-tester/src/contract.rs

View workflow job for this annotation

GitHub Actions / Test Suite

use of deprecated function `cosmwasm_std::to_binary`: use to_json_binary instead
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;

Expand Down Expand Up @@ -100,14 +100,17 @@ fn test_occ_iterator_range(
IteratorOrder::Ascending
).collect::<Result<Vec<(u64, u64)>, StdError>>().unwrap();

for (_, val) in values {
let mut value_attrs: Vec<Attribute> = 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)
)
}

Expand Down

0 comments on commit 6d20612

Please sign in to comment.