Function: swap(address token, address owner, address receiver, uint256 amount, uint256 slippage)

This swaps.

Inputs

  • token

    • Control: Full.

    • Constraints: None.

    • Impact: None.

  • owner

    • Control: Full.

    • Constraints: None.

    • Impact: Owner.

  • receiver

    • Control: Full.

    • Constraints: None.

    • Impact: Receiver.

  • amount

    • Control: Full.

    • Constraints: None.

    • Impact: Amount to swap.

  • slippage

    • Control: Full.

    • Constraints: None.

    • Impact: Slippage in percentage (not correct).

Branches and code coverage (including function calls)

Intended branches

  • Swap functions as intended.

Negative behavior

  • Slippage testing.

Function call analysis

  • swap() -> pair.token0()

    • What is controllable? Everything.

    • If return value controllable, how is it used and how can it go wrong? token0.

    • What happens if it reverts, reenters, or does other unusual control flow? N/A.

  • swap() -> pair.token1()

    • What is controllable? Everything.

    • If return value controllable, how is it used and how can it go wrong? token1.

    • What happens if it reverts, reenters, or does other unusual control flow? N/A.

  • swap() -> token.safeTransferFrom(owner, pair, amount)

    • What is controllable? Everything.

    • If return value controllable, how is it used and how can it go wrong? Discarded.

    • What happens if it reverts, reenters, or does other unusual control flow? N/A.

  • swap() -> pair.swap(amount0Out, amount1Out, receiver, new bytes(0))

    • What is controllable? Receiver.

    • If return value controllable, how is it used and how can it go wrong? Discarded.

    • What happens if it reverts, reenters, or does other unusual control flow? N/A.

  • swap() -> token.safeDecimals()

    • What is controllable? Nothing.

    • If return value controllable, how is it used and how can it go wrong? Token decimals.

    • What happens if it reverts, reenters, or does other unusual control flow? N/A.

  • swap() -> valueOf(token, in_precision + slippage)

    • What is controllable? Nothing.

    • If return value controllable, how is it used and how can it go wrong? Value for calculating slippage (this is erroneous).

    • What happens if it reverts, reenters, or does other unusual control flow? N/A.

Zellic © 2024Back to top ↑