// Return an error if the given address doesn't have any of the required attributes.
Return an error if the given address doesn't have any of the required attributes.
Return an error if the given address doesn ' t have any of the required attributes .
fn ensure_attributes(deps: Deps, addr: Addr, attrs: Vec<String>) -> Result<(), ContractError> {
    // Skip the check if no attributes are required.
    if attrs.is_empty() {
        return Ok(());
    }
    // Check for all provided attributes
    let querier = ProvenanceQuerier::new(&deps.querier);
    for name in attrs.iter() {
        let res = querier.get_attributes(addr.clone(), Some(name))?;
        if !res.attributes.is_empty() {
            return Ok(());
        }
    }
    Err(contract_err(&format!(
        "no kyc attributes found for {}",
        addr
    )))
}
fn ensure_attributes ( deps : Deps , addr : Addr , attrs : Vec < String > ) -> Result < ( ) , ContractError > { // Skip the check if no attributes are required. if attrs . is_empty ( ) { return Ok ( ( ) ) ; } // Check for all provided attributes let querier = ProvenanceQuerier :: new ( & deps . querier ) ; for name in attrs . iter ( ) { let res = querier . get_attributes ( addr . clone ( ) , Some ( name ) ) ? ; if ! res . attributes . is_empty ( ) { return Ok ( ( ) ) ; } } Err ( contract_err ( & format ! ( " " addr ) ) ) }
Return an error if the given address doesn't have any of the required attributes.
Return an error if the given address doesn ' t have any of the required attributes .
deps
Deps
addr
Addr
attrs
Vec<String>