Skip to content

Emit PoolState After Buy and Sell #11

Description

@MrMaxPi
    _accrueFees(fee, tax);
    trackedQuote -= quoteOut;
    trackedTokens += tokensIn;
    _sendQuote(recipient, quoteOut);

    emit CurveSell(msg.sender, recipient, tokensIn, quoteOut, fee, tax, **trackedQuote, trackedTokens**);


    uint256 refund = received - spent;
    if (refund != 0) {
        emit CurveBuyRefunded(msg.sender, refund);
        _sendQuote(msg.sender, refund);
    }

    emit CurveBuy(msg.sender, recipient, spent, tokensOut, fee, tax, **trackedQuote, trackedTokens**);
    _tryAutoGraduate();

That would be much appreciated.

Activity

  1. MeiHui1998 commented on Sep 23, 2026

    @MeiHui1998

    Thanks for the detailed explanation. I agree that exact reconstruction is possible with a complete, ordered event history, and I also agree with your suggestion to emit the getReserves() pair directly.

    That is the main goal of this request: making each trade event self-contained for reserve tracking. If a consumer misses events or starts midway, it currently needs to replay the missing history or fetch a state snapshot before it can reliably track reserves.

    The broader design principle is that each event should independently convey the information needed to interpret the state it reports. For a trade event, that means reporting the resulting tradable reserves alongside the trade amounts. Consumers should not need to reconstruct an entire sequence of previous trades merely to understand the pool state after this one. In my view, making that state explicit is a better event interface, not just a workaround for disconnects.

    Pump’s trade events are a useful reference because they include reserve snapshots. A similar design here would let consumers obtain the post-trade reserves from the event itself, without reconstructing the preceding reserve history.

    So this is not a disagreement with the replay approach—it is a request to simplify integration and recovery by including the post-trade pricing reserves directly in the events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions