Closed cryptomatictrader closed 1 month ago
The pull request introduces enhancements to the PoolManagerKeeperI
interface and the indexerStreamingService
. A new method, RouteCalculateSpotPrice
, is added to the interface for calculating the spot price of trading pairs. Additionally, the indexerStreamingService
now includes a method, setSpotPrice
, to handle spot price calculations during token swap events. Corresponding tests are also added to validate the new functionalities.
File Path | Change Summary |
---|---|
ingest/indexer/domain/keepers.go |
Added method RouteCalculateSpotPrice(ctx sdk.Context, poolId uint64, quoteAssetDenom string, baseAssetDenom string) (price osmomath.BigDec, err error) to PoolManagerKeeperI . |
ingest/indexer/service/indexer_streaming_service.go |
Added method setSpotPrice(ctx context.Context, event *abci.Event) error to indexerStreamingService and modified publishTxn to call setSpotPrice for gammtypes.TypeEvtTokenSwapped events. |
ingest/indexer/service/export_test.go |
Added method SetSpotPrice(ctx context.Context, event *abci.Event) error to indexerStreamingService , calling setSpotPrice . |
ingest/indexer/service/indexer_streaming_service_test.go |
Added test method TestSetSpotPrice() to validate SetSpotPrice functionality and introduced utility functions for attribute checks. |
PoolManagerKeeperI
interface in the same file as the main PR, enhancing the interface's functionality related to pool data, which is relevant to the new RouteCalculateSpotPrice
method introduced in the main PR.publishTxn
method in the indexerStreamingService
, which is related to the changes in the main PR that also involve the indexerStreamingService
and its handling of events, particularly those involving token swaps.Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
This commit resolves the issue where the priceNative data published to Dexscreener occasionally displayed incorrect values due to potential rounding errors. Instead of relying on the token in/out amounts from the token_swapped event to determine the priceNative value, this commit utilizes on-chain spot price data. This data will be published to the indexer backend and made available through the /events endpoint.