Skip to content

Lesson 12 - Can't write test for DSCMint function #1747

Answered by EngrPips
smahdi-dev asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @smahdi-dev, Below is your _healthFactor function. Why did you multiply collateralAdjustedForThreshold by PRECISION in the line below

return (collateralAdjustedForThreshold * PRECISION) / totalDscMinted;
function _healthFactor(address user) internal view returns (uint256) {
        // total DSC minted
        // total collateral value
        (uint256 totalDscMinted, uint256 collateralValueInUsd) = _getAccountInformation(user);
        if (collateralValueInUsd == 0) {
            revert DSCEngine__NoCollateralDeposited();
        }
        if (totalDscMinted == 0) {
            revert DSCEngine__NoDscMinted();
        }
        uint256 collateralAdjustedForThreshold = (collateralVal…

Replies: 2 comments 13 replies

Comment options

You must be logged in to vote
9 replies
@EngrPips
Comment options

@smahdi-dev
Comment options

@EngrPips
Comment options

@smahdi-dev
Comment options

@EngrPips
Comment options

Comment options

You must be logged in to vote
4 replies
@smahdi-dev
Comment options

@EngrPips
Comment options

@smahdi-dev
Comment options

@EngrPips
Comment options

Answer selected by smahdi-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants