pub fn update_config(
    deps: DepsMut,
    info: MessageInfo,
    spend_limit: Option<Uint128>,
    owner: Option<String>,
) -> StdResult<Response> {
    let mut config: Config = read_config(deps.storage)?;
    if config.owner != deps.api.addr_canonicalize(info.sender.as_str())? {
        return Err(StdError::generic_err("Unauthorized"));
    }

    if let Some(spend_limit) = spend_limit {
        config.spend_limit = spend_limit;
    }

    if let Some(owner) = owner {
        config.owner = deps.api.addr_canonicalize(&owner)?;
    }

    store_config(deps.storage, &config)?;

    Ok(Response::new().add_attributes(vec![attr("action", "update_config")]))
}
/// Update Config
/// Owner (governance contract) can update the Config
Update Config
Owner (governance contract) can update the Config
Update Config Owner ( governance contract ) can update the Config
pub fn update_config(
    deps: DepsMut,
    info: MessageInfo,
    spend_limit: Option<Uint128>,
    owner: Option<String>,
) -> StdResult<Response> {
    let mut config: Config = read_config(deps.storage)?;
    if config.owner != deps.api.addr_canonicalize(info.sender.as_str())? {
        return Err(StdError::generic_err("Unauthorized"));
    }
    if let Some(spend_limit) = spend_limit {
        config.spend_limit = spend_limit;
    }
    if let Some(owner) = owner {
        config.owner = deps.api.addr_canonicalize(&owner)?;
    }
    store_config(deps.storage, &config)?;
    Ok(Response::new().add_attributes(vec![attr("action", "update_config")]))
}
pub fn update_config ( deps : DepsMut , info : MessageInfo , spend_limit : Option < Uint128 > , owner : Option < String > , ) -> StdResult < Response > { let mut config : Config = read_config ( deps . storage ) ? ; if config . owner != deps . api . addr_canonicalize ( info . sender . as_str ( ) ) ? { return Err ( StdError :: generic_err ( " " ) ) ; } if let Some ( spend_limit ) = spend_limit { config . spend_limit = spend_limit ; } if let Some ( owner ) = owner { config . owner = deps . api . addr_canonicalize ( & owner ) ? ; } store_config ( deps . storage , & config ) ? ; Ok ( Response :: new ( ) . add_attributes ( vec ! [ attr ( " " " " ) ] ) ) }
Update Config
Owner (governance contract) can update the Config
Update Config Owner ( governance contract ) can update the Config
deps
DepsMut
info
MessageInfo
spend_limit
Option<Uint128>
owner
Option<String>
deps
DepsMut
info
MessageInfo
spend_limit
Option<Uint128>
owner
Option<String>