Function: manageDebtAndStake()
This function is used to manage debt and stake of the smart vault. It is expected to be called from the smart vault manager.
Branches and code coverage
Intended branches
Invoke the
_manageDebtAndStakefunction.Skip when staking is disabled.
Calculate the underlying token value using the manager's
fetchPricefunction.Calculate the target staking amount using the staking factor.
If the target is greater than the minted, mint the debt token and adjust the staking amount.
If the target is less than the minted, burn the debt token and adjust the staking amount.
Negative behavior
Revert if caller is not the manager.
Revert if the contract is paused.
Revert if minting/burning debt token fails.
Function call analysis
The external call flows are the same as the
depositERC20function's_manageDebtAndStakeflow ofSmartVault.