Skip to content

Mistake in _get_y function #16

@zviadm

Description

@zviadm

Hey, I just noticed this file:

if (_k(x0, y + 1) > xy) {

I am pretty sure that is supposed to be '_f' there and not '_k'. Because there will be decimal differences there. It isn't a huge deal, but I am pretty sure it is an unintentional bug.

I am not 100% sure of the consequence of that bug, but my quick guess is that it is sometimes undercutting the value of returned 'y'. So sometimes 'getAmountOut' function returns just tiny bit less than what was possible to get from the swap.

I checked one of the deployed pools too and it seems like bug is in there for all deployed pools.
Example: https://basescan.org/address/0x2647f963fb688b89487d6da49fd1528063a5438b#code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions