Function: bridge(uint256 amountIn, address fromToken, uint16 srcPoolId, uint16 dstPoolId, byte[] payload)
There is no check that msg.value is not less than amountIn in case of fromToken == address(0). The function allows to bridge and deposit to vaults using Stargate.
Inputs
amountInConstraints:
!=0.Impact: The amount of token for the swap.
fromTokenConstraints: There is no check, but it should be the same address as
pool.token().Impact: The address of the token in
srcPoolId.
srcPoolIdConstraints:
router.swapreverts iffactory.getPool(_poolId)returns zero address.Impact: The ID of the SRC pool.
dstPoolIdConstraints: The owner of the router should create and activate the chain path for
_dstChainIdand_dstPoolId. The_dstChainIdis constantARBITRUM_CHAIN_ID.Impact: The ID of the DST pool.
payloadConstraints: This is not verified.
Impact: Contain the data for ZapDest, expected address receiver,
uint256 vaultId, and addressvaultAddress.
Branches and code coverage (including function calls)
Intended branches
The Stargate
swap()is performed properly.
Negative behavior
msg.value < amountInandfromToken == address(0).msg.senderdoes not have enoughfromTokentokens.
Function call analysis
ERC20(fromToken).safeTransferFrom(msg.sender,address(this),amountIn)What is controllable?
fromTokenandamountIn.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? Can reenter but without negative impact.
_bridge(amountIn, fromToken, srcPoolId, dstPoolId, payload) -> IStargateRouter(stargateRouterEth).swapETHAndCall{value: msgValue}What is controllable?
amountIn,fromToken,srcPoolId,dstPoolId, andpayload.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? Deposit funds to the
stargateEthVaultand callstargateRouter.swap. Will revert ifamountIn > msgValue.
_bridge(amountIn, fromToken, srcPoolId, dstPoolId, payload) -> IStargateRouter(stargateRouter).swap{value: msg.value}What is controllable?
amountIn,fromToken,srcPoolId,dstPoolId, andpayload.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? No problem.