@@ -2,10 +2,7 @@ use std::marker::PhantomData;
22use std:: str:: FromStr ;
33
44use cosmwasm_std:: testing:: { MockApi , MockStorage } ;
5- use cosmwasm_std:: {
6- from_json, to_json_binary, Addr , AllBalanceResponse , BalanceResponse , BankQuery , Binary , Coin , ContractResult , OwnedDeps , Querier , QuerierResult ,
7- QueryRequest , SupplyResponse , SystemError , SystemResult , Uint128 , WasmQuery ,
8- } ;
5+ use cosmwasm_std:: { from_json, to_json_binary, Addr , BalanceResponse , BankQuery , Binary , Coin , ContractResult , OwnedDeps , Querier , QuerierResult , QueryRequest , SupplyResponse , SystemError , SystemResult , Uint128 , Uint256 , WasmQuery } ;
96
107use injective_math:: FPDecimal ;
118
@@ -248,7 +245,7 @@ fn default_token_factory_denom_total_supply_handler() -> QuerierResult {
248245fn default_bank_total_supply_handler ( ) -> QuerierResult {
249246 let response = SupplyResponse :: new ( Coin {
250247 denom : "inj" . to_string ( ) ,
251- amount : Uint128 :: from ( 1000u128 ) ,
248+ amount : Uint256 :: from ( 1000u128 ) ,
252249 } ) ;
253250 SystemResult :: Ok ( ContractResult :: from ( to_json_binary ( & response) ) )
254251}
@@ -270,11 +267,6 @@ fn default_balance_bank_query_handler(denom: impl Into<String>) -> QuerierResult
270267 SystemResult :: Ok ( ContractResult :: from ( to_json_binary ( & response) ) )
271268}
272269
273- fn default_all_balances_bank_query_handler ( ) -> QuerierResult {
274- let response = AllBalanceResponse :: new ( vec ! [ Coin :: new( 1000000000000000u128 , "inj" ) ] ) ;
275- SystemResult :: Ok ( ContractResult :: from ( to_json_binary ( & response) ) )
276- }
277-
278270fn default_exchange_params_response_handler ( ) -> QuerierResult {
279271 let denom = "inj" ;
280272
@@ -434,9 +426,6 @@ pub trait HandlesBankBalanceQuery {
434426 fn handle ( & self , address : String , denom : String ) -> QuerierResult ;
435427}
436428
437- pub trait HandlesBankAllBalancesQuery {
438- fn handle ( & self , address : String ) -> QuerierResult ;
439- }
440429
441430pub trait HandlesByAddressQuery {
442431 fn handle ( & self , address : String ) -> QuerierResult ;
@@ -504,7 +493,6 @@ pub struct WasmMockQuerier {
504493 pub token_factory_denom_total_supply_handler : Option < Box < dyn HandlesDenomSupplyQuery > > ,
505494 pub token_factory_denom_creation_fee_handler : Option < Box < dyn HandlesFeeQuery > > ,
506495 pub balance_query_handler : Option < Box < dyn HandlesBankBalanceQuery > > ,
507- pub all_balances_query_handler : Option < Box < dyn HandlesBankAllBalancesQuery > > ,
508496 pub total_supply_handler : Option < Box < dyn HandlesDenomSupplyQuery > > ,
509497 pub registered_contract_info_query_handler : Option < Box < dyn HandlesByAddressQuery > > ,
510498 pub spot_market_orderbook_response_handler : Option < Box < dyn HandlesPriceLevelsQuery > > ,
@@ -555,11 +543,6 @@ impl WasmMockQuerier {
555543 Some ( handler) => handler. handle ( address. to_string ( ) , denom. to_string ( ) ) ,
556544 None => default_balance_bank_query_handler ( denom) ,
557545 } ,
558- #[ allow( deprecated) ]
559- BankQuery :: AllBalances { address } => match & self . all_balances_query_handler {
560- Some ( handler) => handler. handle ( address. to_string ( ) ) ,
561- None => default_all_balances_bank_query_handler ( ) ,
562- } ,
563546 BankQuery :: Supply { denom } => match & self . total_supply_handler {
564547 Some ( handler) => handler. handle ( denom. to_string ( ) ) ,
565548 None => default_bank_total_supply_handler ( ) ,
@@ -767,7 +750,6 @@ impl WasmMockQuerier {
767750 token_factory_denom_total_supply_handler : None ,
768751 token_factory_denom_creation_fee_handler : None ,
769752 balance_query_handler : None ,
770- all_balances_query_handler : None ,
771753 registered_contract_info_query_handler : None ,
772754 denom_decimals_handler : None ,
773755 spot_market_orderbook_response_handler : None ,
@@ -801,10 +783,7 @@ impl TestDeposit {
801783}
802784
803785pub mod handlers {
804- use cosmwasm_std:: {
805- to_json_binary, Addr , AllBalanceResponse , BalanceResponse , Binary , Checksum , CodeInfoResponse , Coin , ContractInfoResponse , ContractResult ,
806- QuerierResult , StdResult , SupplyResponse , SystemError , SystemResult , Uint128 ,
807- } ;
786+ use cosmwasm_std:: { to_json_binary, Addr , BalanceResponse , Binary , Checksum , CodeInfoResponse , Coin , ContractInfoResponse , ContractResult , QuerierResult , SupplyResponse , SystemError , SystemResult , Uint128 , Uint256 } ;
808787 use std:: collections:: HashMap ;
809788
810789 use injective_math:: FPDecimal ;
@@ -824,7 +803,7 @@ pub mod handlers {
824803 TrimmedSpotLimitOrder ,
825804 } ;
826805 use crate :: {
827- HandlesBankAllBalancesQuery , HandlesBankBalanceQuery , HandlesCodeInfo , HandlesContractInfo ,
806+ HandlesBankBalanceQuery , HandlesCodeInfo , HandlesContractInfo ,
828807 HandlesTraderDerivativeOrdersToCancelUpToAmountQuery , MarketMidPriceAndTOBResponse , OracleType ,
829808 } ;
830809
@@ -1202,9 +1181,9 @@ pub mod handlers {
12021181 } ) )
12031182 }
12041183
1205- pub fn create_bank_supply_handler ( supply : Uint128 ) -> Option < Box < dyn HandlesDenomSupplyQuery > > {
1184+ pub fn create_bank_supply_handler ( supply : Uint256 ) -> Option < Box < dyn HandlesDenomSupplyQuery > > {
12061185 struct Temp {
1207- supply : Uint128 ,
1186+ supply : Uint256 ,
12081187 }
12091188 impl HandlesDenomSupplyQuery for Temp {
12101189 fn handle ( & self , denom : String ) -> QuerierResult {
@@ -1273,20 +1252,6 @@ pub mod handlers {
12731252 Some ( Box :: new ( Temp { balances } ) )
12741253 }
12751254
1276- pub fn create_simple_all_balances_bank_query_handler ( balances : Vec < Coin > ) -> Option < Box < dyn HandlesBankAllBalancesQuery > > {
1277- struct Temp {
1278- balances : Vec < Coin > ,
1279- }
1280- impl HandlesBankAllBalancesQuery for Temp {
1281- fn handle ( & self , _: String ) -> QuerierResult {
1282- let res = AllBalanceResponse :: new ( self . balances . to_owned ( ) ) ;
1283-
1284- SystemResult :: Ok ( ContractResult :: from ( to_json_binary ( & res) ) )
1285- }
1286- }
1287- Some ( Box :: new ( Temp { balances } ) )
1288- }
1289-
12901255 pub fn create_atomic_order_fee_multiplier_handler ( multiplier : FPDecimal ) -> Option < Box < dyn HandlesMarketIdQuery > > {
12911256 struct Temp {
12921257 multiplier : FPDecimal ,
@@ -1307,7 +1272,7 @@ pub mod handlers {
13071272 impl HandlesSmartQuery for Temp {
13081273 fn handle ( & self , _contract_addr : & str , _msg : & Binary ) -> QuerierResult {
13091274 match self . result . clone ( ) {
1310- Ok ( resp) => SystemResult :: Ok ( ContractResult :: from ( StdResult :: Ok ( resp) ) ) ,
1275+ Ok ( resp) => SystemResult :: Ok ( ContractResult :: from ( Ok :: < Binary , cosmwasm_std :: StdError > ( resp) ) ) ,
13111276 Err ( err) => SystemResult :: Err ( err) ,
13121277 }
13131278 }
@@ -1322,7 +1287,7 @@ pub mod handlers {
13221287 impl HandlesRawQuery for Temp {
13231288 fn handle ( & self , _contract_addr : & str , _key : & Binary ) -> QuerierResult {
13241289 match self . result . clone ( ) {
1325- Ok ( resp) => SystemResult :: Ok ( ContractResult :: from ( StdResult :: Ok ( resp) ) ) ,
1290+ Ok ( resp) => SystemResult :: Ok ( ContractResult :: from ( Ok :: < Binary , cosmwasm_std :: StdError > ( resp) ) ) ,
13261291 Err ( err) => SystemResult :: Err ( err) ,
13271292 }
13281293 }
@@ -1338,8 +1303,7 @@ pub mod handlers {
13381303
13391304 impl HandlesContractInfo for Temp {
13401305 fn handle ( & self , _contract_addr : & str ) -> QuerierResult {
1341- let response = ContractInfoResponse :: new ( self . code_id , self . creator . to_owned ( ) , None , false , None ) ;
1342-
1306+ let response = ContractInfoResponse :: new ( self . code_id , self . creator . to_owned ( ) , None , false , None , None ) ;
13431307 SystemResult :: Ok ( ContractResult :: from ( to_json_binary ( & response) ) )
13441308 }
13451309 }
0 commit comments