mantra-dex-std 3.1.0

Types used by the MANTRA-dex contracts suite
Documentation
1
2
3
4
5
6
7
8
9
10
11
use cosmwasm_std::{Addr, Deps};

/// Validates a [String] address or returns the default address if the validation fails.
pub fn validate_addr_or_default(deps: &Deps, unvalidated: Option<String>, default: Addr) -> Addr {
    unvalidated
        .map_or_else(
            || Some(default.clone()),
            |recv| deps.api.addr_validate(&recv).ok(),
        )
        .unwrap_or(default)
}