[Assetmanager Review] Refactor Network Query
Closed this issue · 0 comments
ibrizsabin commented
Severity:
Informational
Description:
Enclose queries in separate function for readability and reuse.
fn query_network_address(deps: DepsMut, x_call_addr: &Addr) -> Result<NetworkAddress, ContractError> {
let query_msg = GetNetworkAddress {};
let query = QueryRequest::Wasm(WasmQuery::Smart {
contract_addr: x_call_addr.to_string(),
msg: to_binary(&query_msg).map_err(ContractError::Std)?,
});
deps.querier.query(&query).map_err(ContractError::Std)
}
let xcall_network_address: NetworkAddress = query_network_address(deps, &x_call_addr)?;
File Name:
contracts/core-contracts/cw-asset-manager/src/contract.rs Line No. 129