hats-finance / AlephZeroAMM-0x0d88a9ece90994ecb3ba704730819d71c139f60f

Apache License 2.0
1 stars 0 forks source link

Missing Function to Retrieve k_last State in ink! Pair Contract #39

Open hats-bug-reporter[bot] opened 10 months ago

hats-bug-reporter[bot] commented 10 months ago

Github username: @0xmahdirostami Twitter username: 0xmahdirostami Submission hash (on-chain): 0xc2c7040044a5b6b74de83867f009fa8914160e2543b3459bcba054938eaf4da4 Severity: minor

Description: Description

The ink! implementation lacks a function for retrieving the k_last state. k_last represents the product of reserve0 and reserve1 immediately after the most recent liquidity event. In the original Solidity implementation, the contract includes a public k_last variable along with a getter function. However, in the Rust implementation, there is no assigned function for reading k_last from the pair contract.

Impact

The impact of this issue is considered minor. Adding a function for retrieving k_last from the pair contract would improve the completeness and accessibility of the contract's state.

  1. Proof of Concept (PoC) File

Link to Code

  1. Revised Code File (Optional)

It's recommended to add a function for returning k_last, similar to the UniswapV2 implementation.

This addition will enhance the contract's usability and compatibility with external systems that may need to access the k_last state.

deuszx commented 10 months ago

Thank you for participation. After carefully reviewing the submission we've concluded that this issue is INVALID.

It correctly points out that there's a missing getter for k_last but we do not think that's a problem. We cannot think of a real-life use case that requires it. If it does, k_last is a multiplication of reserves which are available through a public getter.

We hope you participate in the future audits of ink!.