Assessment reports>Awaken Swap>Threat Model>Module: AwakenSwapContract_Helper.cs

Module: AwakenSwapContract_Helper.cs

Function: long[] AddLiquidity(string tokenA, string tokenB, long amountADesired, long amountBDesired, long amountAMin, long amountBMin)

Adds liquidity to a token pair.

Inputs

  • tokenA

    • Validation: Must be a valid token symbol.

    • Impact: Used to add liquidity.

  • tokenB

    • Validation: Must be a valid token symbol.

    • Impact: Used to add liquidity.

  • amountADesired

    • Validation: Must be greater than zero.

    • Impact: Specifies desired amount of tokenA.

  • amountBDesired

    • Validation: Must be greater than zero.

    • Impact: Specifies desired amount of tokenB.

  • amountAMin

    • Validation: Must be greater than or equal to zero.

    • Impact: Ensures minimum amount of tokenA.

  • amountBMin

    • Validation: Must be greater than or equal to zero.

    • Impact: Ensures minimum amount of tokenB.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function interacts with external state (token balances, reserves).

Function: long[] RemoveLiquidity(string tokenA, string tokenB, long liquidityRemoveAmount, long amountAMin, long amountBMin, Address to)

Removes liquidity from a token pair.

Inputs

  • tokenA

    • Validation: Must be a valid token symbol.

    • Impact: Used to remove liquidity.

  • tokenB

    • Validation: Must be a valid token symbol.

    • Impact: Used to remove liquidity.

  • liquidityRemoveAmount

    • Validation: Must be greater than zero.

    • Impact: Specifies amount of liquidity to remove.

  • amountAMin

    • Validation: Must be greater than or equal to zero.

    • Impact: Ensures minimum amount of tokenA to be received.

  • amountBMin

    • Validation: Must be greater than or equal to zero.

    • Impact: Ensures minimum amount of tokenB to be received.

  • to

    • Validation: Must be a valid address.

    • Impact: Specifies recipient address.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function interacts with external state (token balances, reserves).

Function: long MintLPToken(string tokenA, string tokenB, long amountA, long amountB, Address account, string channel)

Mints liquidity pool tokens based on provided token amounts.

Inputs

  • tokenA

    • Validation: Must be a valid token symbol.

    • Impact: Used in minting LP tokens.

  • tokenB

    • Validation: Must be a valid token symbol.

    • Impact: Used in minting LP tokens.

  • amountA

    • Validation: Must be greater than zero.

    • Impact: Specifies the amount of tokenA.

  • amountB

    • Validation: Must be greater than zero.

    • Impact: Specifies the amount of tokenB.

  • account

    • Validation: Must be a valid address.

    • Impact: Recipient of the minted LP tokens.

  • channel

    • Validation: None.

    • Impact: Specifies the channel for the tokens.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function interacts with external state (token balances, reserves).

Function: long[] PerformBurn(Address to, string tokenA, string tokenB, long liquidityRemoveAmount)

Burns liquidity pool tokens and returns the underlying tokens.

Inputs

  • to

    • Validation: Must be a valid address.

    • Impact: Recipient of the underlying tokens.

  • tokenA

    • Validation: Must be a valid token symbol.

    • Impact: Token to be returned.

  • tokenB

    • Validation: Must be a valid token symbol.

    • Impact: Token to be returned.

  • liquidityRemoveAmount

    • Validation: Must be greater than zero.

    • Impact: Specifies the amount of liquidity to burn.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function interacts with external state (token balances, reserves).

Function: void Swap(RepeatedField<long> amounts, RepeatedField<string> path, Address lastTo, string channel)

Performs a token swap along a specified path.

Inputs

  • amounts

    • Validation: Must correspond to the path.

    • Impact: Specifies the amounts for the swap.

  • path

    • Validation: Must be a valid path of token symbols.

    • Impact: Specifies the path for the swap.

  • lastTo

    • Validation: Must be a valid address.

    • Impact: Final recipient of the swap output.

  • channel

    • Validation: None.

    • Impact: Specifies the channel for the swap.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function interacts with external state (token balances, reserves).

Function: void SwapSupportingFeeOnTransferTokens(RepeatedField<string> path, Address lastTo, string channel)

Performs a token swap supporting tokens with transfer fees.

Inputs

  • path

    • Validation: Must be a valid path of token symbols.

    • Impact: Specifies the path for the swap.

  • lastTo

    • Validation: Must be a valid address.

    • Impact: Final recipient of the swap output.

  • channel

    • Validation: None.

    • Impact: Specifies the channel for the swap.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function interacts with external state (token balances, reserves).

Function: void TransferIn(Address pair, Address from, string symbol, long amount)

Transfers tokens into the contract from a specified address.

Inputs

  • pair

    • Validation: Must be a valid address.

    • Impact: Recipient of the transferred tokens.

  • from

    • Validation: Must be a valid address.

    • Impact: Source of the transferred tokens.

  • symbol

    • Validation: Must be a valid token symbol.

    • Impact: Specifies the token to transfer.

  • amount

    • Validation: Must be greater than zero.

    • Impact: Specifies the amount of tokens to transfer.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function interacts with external state (token balances).

Function: void TransferOut(Address pair, Address to, string symbol, long amount)

Transfers tokens out of the contract to a specified address.

Inputs

  • pair

    • Validation: Must be a valid address.

    • Impact: Source of the transferred tokens.

  • to

    • Validation: Must be a valid address.

    • Impact: Recipient of the transferred tokens.

  • symbol

    • Validation: Must be a valid token symbol.

    • Impact: Specifies the token to transfer.

  • amount

    • Validation: Must be greater than zero.

    • Impact: Specifies the amount of tokens to transfer.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function interacts with external state (token balances).

Zellic © 2024Back to top ↑