Function: borrowAsset(address _silo, uint256 _borrowAmount, uint256 _collateralAmount, address _collateralAsset, address _receiver)
This borrows asset from _silo.
Inputs
_siloControl: Full.
Constraints: Needs to be a valid
_siloaddress.Impact: The
_siloaddress.
_borrowAmountControl: Full.
Constraints: N/A.
Impact: The borrowing amount.
_collateralAmountControl: Full.
Constraints: N/A (delegated to silo).
Impact: The collateral amount.
_collateralAssetControl: Full.
Constraints: Needs to be the same as the silo's asset (not enforced by gateway).
Impact: The collateral asset address.
_receiverControl: Full.
Constraints: Needs to be a valid address.
Impact: The receiver address of borrowing asset.
Branches and code coverage (including function calls)
Intended branches
User successfully borrows asset from
_silowith_collateralAmountbeing greater than zero.User successfully borrows asset from
_silowith_collateralAmountbeing equal to zero.User successfully borrows asset from
_silowith_borrowAmountbeing equal to zero.
Negative behavior
Function reverts when
_silois not a valid address.Function reverts when
_collateralAssetis not the same as the silo's asset.Function reverts when
_receiveris not a valid address.Function reverts when
totalAssetamounts to zero.
Function call analysis
rootFunction -> ISilo(address).totalAsset()What is controllable? N/A.
If return value controllable, how is it used and how can it go wrong? It can go wrong by amounting to be zero.
What happens if it reverts, reenters, or does other unusual control flow? N/A.
rootFunction -> ISilo(address).totalBorrow()What is controllable? N/A.
If return value controllable, how is it used and how can it go wrong? N/A.
What happens if it reverts, reenters, or does other unusual control flow? N/A.
rootFunction -> ISilo(address).asset()What is controllable? N/A.
If return value controllable, how is it used and how can it go wrong? It can go wrong by not being equal to
address(asset).What happens if it reverts, reenters, or does other unusual control flow? N/A.
rootFunction -> manager.getLenderFromPair(address)What is controllable?
_siloaddress.If return value controllable, how is it used and how can it go wrong? It can go wrong by being equal to
address(0).What happens if it reverts, reenters, or does other unusual control flow?: N/A.
rootFunction -> manager.requestLiquidity(uint256, address)What is controllable?
_siloaddress.If return value controllable, how is it used and how can it go wrong? The entire
borrowAssettransaction will revert.What happens if it reverts, reenters, or does other unusual control flow? N/A.
rootFunction -> ISilo(address).borrowAsset(uint256, uint256, address)What is controllable?
_siloaddress,_borrowAmount,_collateralAmount, and_receiver.If return value controllable, how is it used and how can it go wrong? It can go wrong if
_collateralAssetis not the same as the silo's asset.What happens if it reverts, reenters, or does other unusual control flow? The entire
borrowAssettransaction will revert.