fn check_fund_balance(
    deps: Deps,
    fund_contract_addr: Addr,
    amount: Uint128,
) -> Result<(), CommunityFundError> {
    let state = STATE.load(deps.storage)?;

    let fund_whale_balance =
        query_token_balance(&deps.querier, state.whale_token_addr, fund_contract_addr)?;
    if amount > fund_whale_balance {
        return Err(CommunityFundError::InsufficientFunds(
            amount,
            fund_whale_balance,
        ));
    };

    Ok(())
}
/// Checks whether or not the community fund has enough balance to make a transaction
Checks whether or not the community fund has enough balance to make a transaction
Checks whether or not the community fund has enough balance to make a transaction
fn check_fund_balance(
    deps: Deps,
    fund_contract_addr: Addr,
    amount: Uint128,
) -> Result<(), CommunityFundError> {
    let state = STATE.load(deps.storage)?;
    let fund_whale_balance =
        query_token_balance(&deps.querier, state.whale_token_addr, fund_contract_addr)?;
    if amount > fund_whale_balance {
        return Err(CommunityFundError::InsufficientFunds(
            amount,
            fund_whale_balance,
        ));
    };
    Ok(())
}
fn check_fund_balance ( deps : Deps , fund_contract_addr : Addr , amount : Uint128 , ) -> Result < ( ) , CommunityFundError > { let state = STATE . load ( deps . storage ) ? ; let fund_whale_balance = query_token_balance ( & deps . querier , state . whale_token_addr , fund_contract_addr ) ? ; if amount > fund_whale_balance { return Err ( CommunityFundError :: InsufficientFunds ( amount , fund_whale_balance , ) ) ; } ; Ok ( ( ) ) }
Checks whether or not the community fund has enough balance to make a transaction
Checks whether or not the community fund has enough balance to make a transaction
deps
Deps
fund_contract_addr
Addr
amount
Uint128
deps
Deps
fund_contract_addr
Addr
amount
Uint128