Skip to content
Request an audit

‹ All findings

Wrong transformation in function previewMintDebt(...)

Crit/HighFuji Finance·Three Sigma · Lending aggregator · 6th May, 20233S-FUJI-H05

Description

In the BorrowingVault.sol the function previewMintDebt(...) is supposed to take an amount of shares and turn them into an amount of debt. Currently it is taking the shares as if they were debt and turning them to shares.

solidity
function previewMintDebt(uint256 shares) public view override returns
(uint256 debt) {
    return _convertDebtToShares(shares, Math.Rounding.Down);
}

Recomendation

Change the function to use _convertToDebt(...) instead of _convertDebtToShares(...), as following

solidity
function previewMintDebt(uint256 shares) public view override returns
(uint256 debt) {
    return _convertToDebt(shares, Math.Rounding.Down);
}

Status

Addressed here: Fujicracy/fuji-v2#624