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

Module: AwakenSwapContract_Views.cs

Function: GetReservesOutput GetReserves(GetReservesInput input)

Fetches the reserve amounts for a given list of token pairs. The function retrieves and validates token pairs and then fetches the reserve amounts and the last block timestamp for each pair.

Inputs

  • input.SymbolPair

    • Validation: Each pair must contain valid token symbols.

    • Impact: Defines the list of token pairs for which reserves are fetched.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function makes no external state-mutating calls.

Function: GetTotalSupplyOutput GetTotalSupply(StringList input)

Fetches the total supply for a given list of token pairs. The function retrieves and validates token pairs, fetches the liquidity-pool token information for each pair, and returns the total supply.

Inputs

  • input.Value

    • Validation: Each pair must contain valid token symbols.

    • Impact: Defines the list of token pairs for which total supply is fetched.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function makes no external state-mutating calls.

Function: Int64Value Quote(QuoteInput input)

Calculates the amount of token B that would be received for a given amount of token A based on the current reserves in the liquidity pool. The function ensures that the token pair exists and retrieves the reserves to perform the calculation.

Inputs

  • input.SymbolA

    • Validation: Must be a valid token symbol.

    • Impact: Specifies the input token for the quote calculation.

  • input.SymbolB

    • Validation: Must be a valid token symbol.

    • Impact: Specifies the output token for the quote calculation.

  • input.AmountA

    • Validation: Must be a nonnegative value.

    • Impact: Specifies the amount of token A for which the quote is being calculated.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function makes no external state-mutating calls.

Function: Int64Value GetAmountIn(GetAmountInInput input)

Calculates the amount of input tokens needed to receive a specific amount of output tokens based on the current reserves in the liquidity pool. The function ensures that the token pair exists and retrieves the reserves to perform the calculation.

Inputs

  • input.SymbolIn

    • Validation: Must be a valid token symbol.

    • Impact: Specifies the input token for the calculation.

  • input.SymbolOut

    • Validation: Must be a valid token symbol.

    • Impact: Specifies the output token for the calculation.

  • input.AmountOut

    • Validation: Must be a nonnegative value.

    • Impact: Specifies the desired amount of output tokens.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function makes no external state-mutating calls.

Function: Int64Value GetAmountOut(GetAmountOutInput input)

Calculates the amount of output tokens received for a given amount of input tokens based on the current reserves in the liquidity pool.

Inputs

  • input.SymbolIn

    • Validation: Must be a valid token symbol.

    • Impact: Specifies the input token for the calculation.

  • input.SymbolOut

    • Validation: Must be a valid token symbol.

    • Impact: Specifies the output token for the calculation.

  • input.AmountIn

    • Validation: Must be a nonnegative value.

    • Impact: Specifies the amount of input tokens.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function makes no external state-mutating calls.

Function: GetAmountsInOutput GetAmountsIn(GetAmountsInInput input)

Calculates the amounts of input tokens needed to receive a specific amount of output tokens along a specified path.

Inputs

  • input.AmountOut

    • Validation: Must be a nonnegative value.

    • Impact: Specifies the desired amount of output tokens.

  • input.Path

    • Validation: Must contain valid token symbols for the swap path.

    • Impact: Defines the route for the token swap.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function makes no external state-mutating calls.

Function: GetAmountsOutOutput GetAmountsOut(GetAmountsOutInput input)

Calculates the amounts of output tokens received for a specific amount of input tokens along a specified path.

Inputs

  • input.AmountIn

    • Validation: Must be a nonnegative value.

    • Impact: Specifies the amount of input tokens.

  • input.Path

    • Validation: Must contain valid token symbols for the swap path.

    • Impact: Defines the route for the token swap.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function makes no external state-mutating calls.

Function: BigIntValue GetKLast(Address pair)

Retrieves the last-known constant product (K value) for a given liquidity pair.

Inputs

  • pair

    • Validation: Must be a valid address.

    • Impact: Specifies the liquidity pair for which the K value is being retrieved.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function makes no external state-mutating calls.

Function: Address GetAdmin(Empty input)

Retrieves the admin address for the contract.

Inputs

  • input

    • Validation: Not applicable (empty input).

    • Impact: No impact on the function.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

  • None.

Function call analysis

This function makes no external state-mutating calls.

Function: Address GetFeeTo(Empty input)

Retrieves the address designated to receive fees for the contract.

Inputs

  • input

    • Validation: Not applicable (empty input).

    • Impact: No impact on the function.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

  • None.

Function call analysis

This function makes no external state-mutating calls.

Function: Int64Value GetFeeRate(Empty input)

Retrieves the fee rate for the contract.

Inputs

  • input

    • Validation: Not applicable (empty input).

    • Impact: No impact on the function.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

  • None.

Function call analysis

This function makes no external state-mutating calls.

Function: Address GetPairAddress(GetPairAddressInput input)

Retrieves the address of the liquidity pair for the given token symbols.

Inputs

  • input.SymbolA

    • Validation: Must be a valid token symbol.

    • Impact: Specifies the first token symbol of the pair.

  • input.SymbolB

    • Validation: Must be a valid token symbol.

    • Impact: Specifies the second token symbol of the pair.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

This function makes no external state-mutating calls.

Zellic © 2024Back to top ↑