Assessment reports>Stable Predeposit>Threat Model>Function: bridgeToStable(uint256 shares, address recipient, bytes lzOpts, uint16 slippageBps)

Function: bridgeToStable(uint256 shares, address recipient, bytes lzOpts, uint16 slippageBps)

This function unwraps vault shares and bridges underlying assets to Stable, over LayerZero.

Inputs

  • shares

    • Control: Full.

    • Constraints: The amount cannot be zero. Due to the transferFrom call, 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.

  • recipient

    • Control: Full.

    • Constraints: The address cannot be the zero address.

    • Impact: The address on Stable that will receive the bridged assets.

  • lzOpts

    • Control: 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.

  • slippageBps

    • Control: Full.

    • Constraints: Must be between 0 and MAX_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

  • shares cannot be zero.

  • recipient cannot 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.

Zellic © 2025Back to top ↑