Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sei tester functionality for iterator heavy workloads #71

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

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 @@
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 Expand Up @@ -382,14 +385,14 @@
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn query(deps: Deps<SeiQueryWrapper>, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
match msg {
QueryMsg::ExchangeRates {} => to_binary(&query_exchange_rates(deps)?),

Check warning on line 388 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

Check warning on line 388 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
QueryMsg::OracleTwaps { lookback_seconds } => {
to_binary(&query_oracle_twaps(deps, lookback_seconds)?)

Check warning on line 390 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

Check warning on line 390 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
}
QueryMsg::DexTwaps {
contract_address,
lookback_seconds,
} => to_binary(&query_dex_twaps(deps, contract_address, lookback_seconds)?),

Check warning on line 395 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

Check warning on line 395 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
QueryMsg::OrderSimulation {
order,
contract_address,
Expand Down
Loading