Skip to content

Commit

Permalink
to_binary -> to_json_binary
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeHartnell committed Dec 5, 2023
1 parent 615157a commit 46735aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions contracts/external/cw-abc/src/commands.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cosmwasm_std::{
ensure, to_binary, Addr, BankMsg, Coin, CosmosMsg, Decimal as StdDecimal, DepsMut, Env,
ensure, to_json_binary, Addr, BankMsg, Coin, CosmosMsg, Decimal as StdDecimal, DepsMut, Env,
MessageInfo, QuerierWrapper, Response, StdError, StdResult, Storage, SubMsg, Uint128, WasmMsg,
};
use cw_tokenfactory_issuer::msg::ExecuteMsg as IssuerExecuteMsg;
Expand Down Expand Up @@ -97,7 +97,7 @@ pub fn execute_buy(deps: DepsMut<TokenFactoryQuery>, _env: Env, info: MessageInf
let issuer_addr = TOKEN_ISSUER_CONTRACT.load(deps.storage)?;
let mint_msg = WasmMsg::Execute {
contract_addr: issuer_addr.to_string(),
msg: to_binary(&IssuerExecuteMsg::Mint {
msg: to_json_binary(&IssuerExecuteMsg::Mint {
to_address: info.sender.to_string(),
amount: minted,
})?,
Expand Down Expand Up @@ -163,7 +163,7 @@ pub fn execute_sell(deps: DepsMut<TokenFactoryQuery>, _env: Env, info: MessageIn
// Execute burn on the cw-tokenfactory-issuer contract
CosmosMsg::<TokenFactoryMsg>::Wasm(WasmMsg::Execute {
contract_addr: issuer_addr.to_string(),
msg: to_binary(&IssuerExecuteMsg::Burn {
msg: to_json_binary(&IssuerExecuteMsg::Burn {
from_address: info.sender.to_string(),
amount: burn_amount,
})?,
Expand Down
24 changes: 12 additions & 12 deletions contracts/external/cw-abc/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, SubMsg,
to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, SubMsg,
Uint128, WasmMsg,
};
use cw2::set_contract_version;
Expand Down Expand Up @@ -95,7 +95,7 @@ pub fn instantiate(
WasmMsg::Instantiate {
admin: Some(info.sender.to_string()),
code_id: token_issuer_code_id,
msg: to_binary(&IssuerInstantiateMsg::NewToken {
msg: to_json_binary(&IssuerInstantiateMsg::NewToken {
subdenom: supply.subdenom.clone(),
})?,
funds: info.funds,
Expand Down Expand Up @@ -155,17 +155,17 @@ pub fn do_query(
) -> StdResult<Binary> {
match msg {

Check warning on line 156 in contracts/external/cw-abc/src/contract.rs

View check run for this annotation

Codecov / codecov/patch

contracts/external/cw-abc/src/contract.rs#L150-L156

Added lines #L150 - L156 were not covered by tests
// custom queries
QueryMsg::CurveInfo {} => to_binary(&queries::query_curve_info(deps, curve_fn)?),
QueryMsg::PhaseConfig {} => to_binary(&queries::query_phase_config(deps)?),
QueryMsg::CurveInfo {} => to_json_binary(&queries::query_curve_info(deps, curve_fn)?),
QueryMsg::PhaseConfig {} => to_json_binary(&queries::query_phase_config(deps)?),
QueryMsg::Donations { start_after, limit } => {
to_binary(&queries::query_donations(deps, start_after, limit)?)
to_json_binary(&queries::query_donations(deps, start_after, limit)?)

Check warning on line 161 in contracts/external/cw-abc/src/contract.rs

View check run for this annotation

Codecov / codecov/patch

contracts/external/cw-abc/src/contract.rs#L158-L161

Added lines #L158 - L161 were not covered by tests
}
QueryMsg::Hatchers { start_after, limit } => {
to_binary(&queries::query_hatchers(deps, start_after, limit)?)
to_json_binary(&queries::query_hatchers(deps, start_after, limit)?)

Check warning on line 164 in contracts/external/cw-abc/src/contract.rs

View check run for this annotation

Codecov / codecov/patch

contracts/external/cw-abc/src/contract.rs#L163-L164

Added lines #L163 - L164 were not covered by tests
}
QueryMsg::Ownership {} => to_binary(&cw_ownable::get_ownership(deps.storage)?),
QueryMsg::Denom {} => to_binary(&queries::get_denom(deps)?),
QueryMsg::TokenContract {} => to_binary(&TOKEN_ISSUER_CONTRACT.load(deps.storage)?),
QueryMsg::Ownership {} => to_json_binary(&cw_ownable::get_ownership(deps.storage)?),
QueryMsg::Denom {} => to_json_binary(&queries::get_denom(deps)?),
QueryMsg::TokenContract {} => to_json_binary(&TOKEN_ISSUER_CONTRACT.load(deps.storage)?),

Check warning on line 168 in contracts/external/cw-abc/src/contract.rs

View check run for this annotation

Codecov / codecov/patch

contracts/external/cw-abc/src/contract.rs#L166-L168

Added lines #L166 - L168 were not covered by tests
}
}

Check warning on line 170 in contracts/external/cw-abc/src/contract.rs

View check run for this annotation

Codecov / codecov/patch

contracts/external/cw-abc/src/contract.rs#L170

Added line #L170 was not covered by tests

Expand Down Expand Up @@ -206,7 +206,7 @@ pub fn reply(
// Grant an allowance to mint
WasmMsg::Execute {
contract_addr: issuer_addr.clone(),
msg: to_binary(&IssuerExecuteMsg::SetMinterAllowance {
msg: to_json_binary(&IssuerExecuteMsg::SetMinterAllowance {
address: env.contract.address.to_string(),
// Allowance needs to be max as this the is the amount of tokens
// the minter is allowed to mint, not to be confused with max supply
Expand All @@ -218,7 +218,7 @@ pub fn reply(
// Grant an allowance to burn
WasmMsg::Execute {
contract_addr: issuer_addr.clone(),
msg: to_binary(&IssuerExecuteMsg::SetBurnerAllowance {
msg: to_json_binary(&IssuerExecuteMsg::SetBurnerAllowance {
address: env.contract.address.to_string(),
allowance: Uint128::MAX,
})?,
Expand Down Expand Up @@ -247,7 +247,7 @@ pub fn reply(

msgs.push(WasmMsg::Execute {
contract_addr: issuer_addr.clone(),
msg: to_binary(&IssuerExecuteMsg::SetDenomMetadata {
msg: to_json_binary(&IssuerExecuteMsg::SetDenomMetadata {
metadata: Metadata {
description: metadata.description,
denom_units,
Expand Down

0 comments on commit 46735aa

Please sign in to comment.