Assessment reports>Y2K Finance>Threat Model>_bridgeWithCeler

Function: _bridgeWithCeler(address _receiver, address _token, uint256 _amount, uint16 _dstChainId, uint256 maxSlippage)

This bridges with Celer.

Inputs

  • _receiver

    • Constraints: No constraints.

    • Impact: The address to receive the bridged tokens.

  • _token

    • Constraints: No constraints.

    • Impact: The address of the token to bridge.

  • _amount

    • Constraints: No constraints.

    • Impact: The amount of the token to bridge.

  • _dstChainId

    • Constraints: No constraints.

    • Impact: The ID of the chain the token is being bridged to.

  • maxSlippage

    • Constraints: No constraints.

    • Impact: The max slippage allowed for the bridge.

Branches and code coverage (including function calls)

Intended branches

  • The function approves the celerBridge contract to spend _amount of _token.

  • The function call celerBridge.send(...) succeeds without reverting.

Negative behavior

  • The function reverts if the approval for celerBridge fails.

Function call analysis

  • ERC20(_token).safeApprove(address(celerBridge), _amount)

    • What is controllable? _token and _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.

  • celerBridge.send(_receiver, _token, _amount, _dstChainId, uint64(block.timestamp), uint32(maxSlippage))

    • What is controllable? _receiver, _token, _amount, _dstChainId, block.timestamp, and maxSlippage.

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

Zellic © 2024Back to top ↑