fn try_remove_kyc(
    deps: DepsMut,
    info: MessageInfo,
    name: String,
) -> Result<Response<ProvenanceMsg>, ContractError> {
    // Validate params.
    if !info.funds.is_empty() {
        return Err(contract_err("no funds should be sent during kyc remove"));
    }
    if name.trim().is_empty() {
        return Err(contract_err("kyc attribute name is empty"));
    }

    // Load state and ensure sender is the administrator.
    let mut state = config(deps.storage).load()?;
    if info.sender != state.admin {
        return Err(ContractError::Unauthorized {});
    }

    // Ensure kyc attribute wasn't already added
    if !state.kyc_attrs.contains(&name) {
        return Err(contract_err("kyc attribute does not exist"));
    }

    // Remove the kyc attribute and save
    state.kyc_attrs.retain(|n| *n != name);
    config(deps.storage).save(&state)?;

    // Add wasm event attributes
    Ok(Response::new()
        .add_attribute("action", "remove_kyc_attribute")
        .add_attribute("name", name))
}
// Remove an existing kyc attribute.
Remove an existing kyc attribute.
Remove an existing kyc attribute .
fn try_remove_kyc(
    deps: DepsMut,
    info: MessageInfo,
    name: String,
) -> Result<Response<ProvenanceMsg>, ContractError> {
    // Validate params.
    if !info.funds.is_empty() {
        return Err(contract_err("no funds should be sent during kyc remove"));
    }
    if name.trim().is_empty() {
        return Err(contract_err("kyc attribute name is empty"));
    }
    // Load state and ensure sender is the administrator.
    let mut state = config(deps.storage).load()?;
    if info.sender != state.admin {
        return Err(ContractError::Unauthorized {});
    }
    // Ensure kyc attribute wasn't already added
    if !state.kyc_attrs.contains(&name) {
        return Err(contract_err("kyc attribute does not exist"));
    }
    // Remove the kyc attribute and save
    state.kyc_attrs.retain(|n| *n != name);
    config(deps.storage).save(&state)?;
    // Add wasm event attributes
    Ok(Response::new()
        .add_attribute("action", "remove_kyc_attribute")
        .add_attribute("name", name))
}
fn try_remove_kyc ( deps : DepsMut , info : MessageInfo , name : String , ) -> Result < Response < ProvenanceMsg > , ContractError > { // Validate params. if ! info . funds . is_empty ( ) { return Err ( contract_err ( " " ) ) ; } if name . trim ( ) . is_empty ( ) { return Err ( contract_err ( " " ) ) ; } // Load state and ensure sender is the administrator. let mut state = config ( deps . storage ) . load ( ) ? ; if info . sender != state . admin { return Err ( ContractError :: Unauthorized { } ) ; } // Ensure kyc attribute wasn't already added if ! state . kyc_attrs . contains ( & name ) { return Err ( contract_err ( " " ) ) ; } // Remove the kyc attribute and save state . kyc_attrs . retain ( | n | * n != name ) ; config ( deps . storage ) . save ( & state ) ? ; // Add wasm event attributes Ok ( Response :: new ( ) . add_attribute ( " " , " " ) . add_attribute ( " " , name ) ) }
Remove an existing kyc attribute.
Remove an existing kyc attribute .
deps
DepsMut
info
MessageInfo
name
String
deps
DepsMut
info
MessageInfo
name
String