Function: bridgeToStable(uint256 shares, address recipient, bytes lzOpts, uint16 slippageBps)
This function unwraps vault shares and bridges underlying assets to Stable, over LayerZero.
Inputs
sharesControl: Full.
Constraints: The amount cannot be zero. Due to the
transferFromcall, the user must have at least this many shares and have approved the bridge contract to spend them.Impact: The number of shares to redeem and bridge.
recipientControl: Full.
Constraints: The address cannot be the zero address.
Impact: The address on Stable that will receive the bridged assets.
lzOptsControl: Full.
Constraints: Must be a valid LayerZero options byte array (enforced by the messaging library in LayerZero).
Impact: Options for the LayerZero message, such as extra gas.
slippageBpsControl: Full.
Constraints: Must be between
0andMAX_SLIPPAGE_BPS(500).Impact: The slippage tolerance in basis points for the bridge.
Branches and code coverage
Intended branches
Successfully able to call the function with intended behavior.
Negative behavior
sharescannot be zero.recipientcannot be the zero address.Slippage is too high.
Insufficient fee is paid.
Caller has insufficient balance or allowance of vault shares.
Function call analysis
this.VAULT.transferFrom(msg.sender, address(this), shares)What is controllable?
shares.If the return value is 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? The transaction reverts.
this._redeemSharesAndBridgeToStable(shares, msg.sender, this._addressToBytes32(recipient), lzOpts, slippageBps) -> this.VAULT.redeemBridge(shares, address(this), address(this))What is controllable? All of the arguments to some extent, besides
msg.sender.If the return value is 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? The transaction reverts.