Skip to content

Commit

Permalink
ignore lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jhernandezb committed Mar 27, 2024
1 parent b55a074 commit 721e86a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 23 deletions.
22 changes: 13 additions & 9 deletions contracts/whitelist-updatable-flatrate/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::state::{Config, CONFIG, TOTAL_ADDRESS_COUNT, WHITELIST};
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
ensure, to_binary, Addr, Binary, Deps, DepsMut, Empty, Env, Event, MessageInfo, Order,
ensure, to_json_binary, Addr, Binary, Deps, DepsMut, Empty, Env, Event, MessageInfo, Order,
StdError, StdResult,
};
use cw2::set_contract_version;
Expand Down Expand Up @@ -271,14 +271,18 @@ pub fn execute_purge(deps: DepsMut, info: MessageInfo) -> Result<Response, Contr
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
match msg {
QueryMsg::Config {} => to_binary(&query_config(deps)?),
QueryMsg::IncludesAddress { address } => to_binary(&query_includes_address(deps, address)?),
QueryMsg::MintCount { address } => to_binary(&query_mint_count(deps, address)?),
QueryMsg::Admins {} => to_binary(&query_admins(deps)?),
QueryMsg::AddressCount {} => to_binary(&query_address_count(deps)?),
QueryMsg::PerAddressLimit {} => to_binary(&query_per_address_limit(deps)?),
QueryMsg::IsProcessable { address } => to_binary(&query_is_processable(deps, address)?),
QueryMsg::MintDiscountAmount {} => to_binary(&query_mint_discount_amount(deps)?),
QueryMsg::Config {} => to_json_binary(&query_config(deps)?),
QueryMsg::IncludesAddress { address } => {
to_json_binary(&query_includes_address(deps, address)?)
}
QueryMsg::MintCount { address } => to_json_binary(&query_mint_count(deps, address)?),
QueryMsg::Admins {} => to_json_binary(&query_admins(deps)?),
QueryMsg::AddressCount {} => to_json_binary(&query_address_count(deps)?),
QueryMsg::PerAddressLimit {} => to_json_binary(&query_per_address_limit(deps)?),
QueryMsg::IsProcessable { address } => {
to_json_binary(&query_is_processable(deps, address)?)
}
QueryMsg::MintDiscountAmount {} => to_json_binary(&query_mint_discount_amount(deps)?),
}
}

Expand Down
10 changes: 5 additions & 5 deletions contracts/whitelist-updatable-flatrate/src/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{
to_json_binary, Addr, QuerierWrapper, QueryRequest, StdResult, WasmMsg, WasmQuery,
to_binary, Addr, Decimal, QuerierWrapper, QueryRequest, StdResult, WasmMsg, WasmQuery,
};
use sg_std::CosmosMsg;

Expand All @@ -19,7 +19,7 @@ impl WhitelistUpdatableFlatrateContract {
}

pub fn call<T: Into<ExecuteMsg>>(&self, msg: T) -> StdResult<CosmosMsg> {
let msg = to_json_binary(&msg.into())?;
let msg = to_binary(&msg.into())?;
Ok(WasmMsg::Execute {
contract_addr: self.addr().into(),
msg,
Expand All @@ -37,15 +37,15 @@ impl WhitelistUpdatableFlatrateContract {
pub fn includes(&self, querier: &QuerierWrapper, address: String) -> StdResult<bool> {
let includes: bool = querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
contract_addr: self.addr().into(),
msg: to_json_binary(&QueryMsg::IncludesAddress { address })?,
msg: to_binary(&QueryMsg::IncludesAddress { address })?,
}))?;
Ok(includes)
}

pub fn config(&self, querier: &QuerierWrapper) -> StdResult<Config> {
let res: Config = querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
contract_addr: self.addr().into(),
msg: to_json_binary(&QueryMsg::Config {})?,
msg: to_binary(&QueryMsg::Config {})?,
}))?;

Ok(res)
Expand All @@ -54,7 +54,7 @@ impl WhitelistUpdatableFlatrateContract {
pub fn mint_discount_amount(&self, querier: &QuerierWrapper) -> StdResult<Option<u64>> {
querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
contract_addr: self.addr().into(),
msg: to_json_binary(&QueryMsg::MintDiscountAmount {})?,
msg: to_binary(&QueryMsg::MintDiscountAmount {})?,
}))
}
}
11 changes: 6 additions & 5 deletions contracts/whitelist-updatable/src/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{
to_binary, Addr, Decimal, QuerierWrapper, QueryRequest, StdResult, WasmMsg, WasmQuery,
to_json_binary, to_json_binary, Addr, Decimal, QuerierWrapper, QueryRequest, StdResult,
WasmMsg, WasmQuery,
};
use sg_std::CosmosMsg;

Expand All @@ -19,7 +20,7 @@ impl WhitelistUpdatableContract {
}

pub fn call<T: Into<ExecuteMsg>>(&self, msg: T) -> StdResult<CosmosMsg> {
let msg = to_binary(&msg.into())?;
let msg = to_json_binary(&msg.into())?;
Ok(WasmMsg::Execute {
contract_addr: self.addr().into(),
msg,
Expand All @@ -37,15 +38,15 @@ impl WhitelistUpdatableContract {
pub fn includes(&self, querier: &QuerierWrapper, address: String) -> StdResult<bool> {
let includes: bool = querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
contract_addr: self.addr().into(),
msg: to_binary(&QueryMsg::IncludesAddress { address })?,
msg: to_json_binary(&QueryMsg::IncludesAddress { address })?,
}))?;
Ok(includes)
}

pub fn config(&self, querier: &QuerierWrapper) -> StdResult<Config> {
let res: Config = querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
contract_addr: self.addr().into(),
msg: to_binary(&QueryMsg::Config {})?,
msg: to_json_binary(&QueryMsg::Config {})?,
}))?;

Ok(res)
Expand All @@ -54,7 +55,7 @@ impl WhitelistUpdatableContract {
pub fn mint_discount_percent(&self, querier: &QuerierWrapper) -> StdResult<Option<Decimal>> {
querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
contract_addr: self.addr().into(),
msg: to_binary(&QueryMsg::MintDiscountPercent {})?,
msg: to_json_binary(&QueryMsg::MintDiscountPercent {})?,
}))
}
}
8 changes: 4 additions & 4 deletions packages/sg-name/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{to_vec, Addr};
use cosmwasm_std::{to_json_vec, Addr};

pub const MAX_TEXT_LENGTH: u32 = 512;

Expand All @@ -13,7 +13,7 @@ pub struct NFT {

impl NFT {
pub fn into_json_string(self: &NFT) -> String {
String::from_utf8(to_vec(&self).unwrap_or_default()).unwrap_or_default()
String::from_utf8(to_json_vec(&self).unwrap_or_default()).unwrap_or_default()
}
}

Expand All @@ -34,7 +34,7 @@ impl TextRecord {
}

pub fn into_json_string(self: &TextRecord) -> String {
String::from_utf8(to_vec(&self).unwrap_or_default()).unwrap_or_default()
String::from_utf8(to_json_vec(&self).unwrap_or_default()).unwrap_or_default()
}
}

Expand All @@ -53,7 +53,7 @@ impl Metadata {
// and represent it as a type. Note that we have to use the CosmWasm fork
// of serde_json to avoid floats.
pub fn into_json_string(self: &Metadata) -> String {
String::from_utf8(to_vec(&self).unwrap_or_default()).unwrap_or_default()
String::from_utf8(to_json_vec(&self).unwrap_or_default()).unwrap_or_default()
}
}

Expand Down

0 comments on commit 721e86a

Please sign in to comment.