Function: _bridgeByStargate(uint256 refId, address payable to, uint256 msgValue, uint256 bridgeAmount, SrcInfos srcInfos, DstInfos dstInfos, Dst1inch dst1inch)
Allows bridging via StarGate.
Inputs
refIdControl: Fully controlled by the calling function.
Constraints: None.
Impact: The reference ID of the transaction.
toControl: Fully controlled by the calling function.
Constraints: None.
Impact: The address to send the bridged tokens to.
msgValueControl: Fully controlled by the calling function.
Constraints: None. Theoretically only used for the
nativeswap case.Impact: Cumulated
msg.valuefrom the calling function.
bridgeAmountControl: Fully controlled by the calling function.
Constraints: None. Assumed that these tokens have been transferred atomically (i.e., same transaction) to this contract.
Impact: The amount of the bridged token.
srcInfosControl: Fully controlled by the calling function.
Constraints: Minimal. Most are performed in the calling function.
Impact: The source information.
dstInfosControl: Fully controlled by the calling function.
Constraints: Minimal. Most are performed in the calling function.
Impact: The destination information.
dst1inchControl: Fully controlled by the calling function.
Constraints: None. Assumed to be valid.
Impact: The
1inchrouter to use for the swap (if any).
Branches and code coverage
Intended branches
If
bridgeTokenis WETH, withdraw thebridgeAmountfrom the WETH contract so that it can be used as themsg.value.If
bridgeTokenis not WETH, approve thebridgeAmountof thebridgeTokento the StarGate router. Assumes these tokens have been transferred atomically (i.e., same transaction) to this contract.Forward the cross-chain swap to StarGate and forward the
payload.
Negative behavior
Caller is a service admin.
Negative behavior should be what the function requires.