balancednetwork/balanced-rust-contracts

[TokenContract Review] Refactor minter check.

Closed this issue · 1 comments

Severity:

Informational

Description:

 let mut config = TOKEN_INFO
        .may_load(deps.storage)?
        .ok_or(ContractError::Unauthorized {})?;

    let mint = config.mint.as_ref().ok_or(ContractError::Unauthorized {})?;
    if mint.minter != info.sender {
        return Err(ContractError::Unauthorized {});
    }

we can enclose this into single function as 'ensure_minter'

File Name:

contracts/token-contracts/cw-hub-bnusd/src/contract.rs Line No. 392

This is not our code, but the code from cw_20 token codebase