Function: _bridgeWithHop(address _receiver, address _token, uint256 _amount, uint16 _srcChainId, uint256 maxSlippage, uint256 bonderFee)
This bridges with Hop.
Inputs
_receiverConstraints: No constraints.
Impact: The address to receive the bridged tokens.
_tokenConstraints: No constraints.
Impact: The address of the token to bridge.
_amountConstraints: No constraints.
Impact: The amount of the token to bridge.
_srcChainIdConstraints: No constraints.
Impact: The ID of the chain the token is being bridged from.
maxSlippageConstraints: Should be less than or equal to 10,000.
Impact: The max slippage allowed for the bridge --- input of 100 would be 1% slippage.
bonderFeeConstraints: No constraints.
Impact: The fee to pay the bonder.
Branches and code coverage (including function calls)
Intended branches
The function calculates
amountOutMincorrectly based onmaxSlippage.The function approves the
bridgeAddressto spend_amountof_token.The function call to
HopBridgesucceeds without reverting.
Negative behavior
The function reverts if
bridgeAddressisaddress(0).The function reverts if the approval for
bridgeAddressfails.The function reverts if
maxSlippageis greater than 10,000.The function reverts if the external call to
HopBridgereverts.
Function call analysis
ERC20(_token).safeApprove(bridgeAddress, _amount)What is controllable?
_tokenand_amount.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? If this reverts, the entire call fails --- no reentrancy issues.
IHopBridge(bridgeAddress).swapAndSend(_srcChainId, _receiver, _amount, bonderFee, amountOutMin, deadline, (amountOutMin * 998) / 1000, deadline)What is controllable?
_srcChainId,_receiver,_amount,bonderFee, andamountOutMin.If return value controllable, how is it used and how can it go wrong? The return value is not controlled, but its impact is significant as it bridges the tokens; incorrect values could lead to incorrect token transfers.
What happens if it reverts, reenters, or does other unusual control flow? If this reverts, the entire call fails --- no reentrancy issues.