Function: replenishReserves(address _token, uint256 _amount)
This function allows a strategy contract to repay a specified amount of debt with a given token.
Inputs
_tokenControl: Full control by the caller.
Constraints: There are no constraints.
Impact: Specifies the token in which the debt is being repaid.
_amountControl: Full control by the caller.
Constraints: The function will revert if the strategy does not have enough debt to repay this amount.
Impact: Represents the amount of the token to be repaid.
Branches and code coverage
Intended branches
Check that tokens have been transferred from the caller.
Check that
getPortStrategyTokenDebthas been decreased.
Negative behavior
Caller is not trusted strategy.
The
_amountis more than the debt for this strategy.
Function call analysis
IPortStrategy(msg.sender).withdraw(address(this), _token, _amount)What is controllable?
_tokenand_amountare controlled by the caller, but if_amountis not zero, the function will revert if the caller/strategy does not have enough debt to repay this amount.If the return value is controllable, how is it used and how can it go wrong? There is no return value.
What happens if it reverts, reenters or does other unusual control flow? N/A.