StackAsk is a community where developers ask questions, share answers and learn from each others real-world experience, so every solved problem helps the next person who runs into it.
use cosmwasm_std::{ Response, StdError, StdResult, Addr, Storage }; use cw_storage_plus::Map;const HOSPITALS: Map<&Addr, Hospital> = Map::new("hospitals");pub fn execute_hospital_register( store: &mut dyn Storage, hospital: &Hospital ) -> Result<Response, ContractError> { let save_result = HOSPITALS.save(store, &hospital.address, hospital); if save_result.is_err() { return Err(ContractError::SaveError {}); } return Ok(Response::default()); } fn query_hospital(deps: Deps, wallet_address: &Addr) -> StdResult<Binary> { let hospital = HOSPITALS.load(deps.storage, wallet_address); let resp = match hospital {Ok(data) => HospitalResponse { hospital: data.clone(), }, Err(err) => { return Err(err); } };
2.2K Point(s)
1.2K Point(s)
313 Point(s)
178 Point(s)
138 Point(s)
Input your email to receive reset password link, or if you remember your password, you can click