The compiler is returning unused mutable warning. Warning is returned on deposit_amount and sender variables.
fn try_deposit(
deps: DepsMut,
env: Env,
info: MessageInfo,
mut config: &mut ConfigInfo,
priority: u8,
from: Option<String>,
amount: Option<Uint128>,
) -> StdResult<()> {
//CHECKING: if the contract is in the correct status to perform this handle function.
check_status(config.status, priority)?;
let mut deposit_amount: Uint128 = Uint128::zero(); // A thin wrapper around u128 that is using strings for JSON encoding/decoding. More here:https://github.com/scrtlabs/cosmwasm/blob/secret/packages/std/src/math/uint128.rs
let mut sender: Addr; // A human-readable address. More here https://github.com/scrtlabs/cosmwasm/blob/secret/packages/std/src/addresses.rs
if from.as_ref().is_some() && amount.as_ref().is_some() {
deposit_amount = check_if_valid_amount(&info, &config, true, amount)?;
sender = deps.api.addr_validate(from.as_ref().unwrap().as_str())?;
} else {
//CHECKING: Amount of deposit > minimum deposit amount
deposit_amount = check_if_valid_amount(&info, &config, false, None)?;
sender = info.sender;
}
//Using deposit_amount and sender here
Ok(())
}
check_if_validate_amount function
fn check_if_valid_amount(
) -> StdResult<Uint128> {
let mut deposit_amount = Uint128::zero();
//Extracting deposit amount
deposit_amount = extracted_amount
return Ok(deposit_amount);
}