Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(txfees, gamm): remove taker fee swap event from trade events #87

Draft
wants to merge 3 commits into
base: main-dym
Choose a base branch
from

Conversation

mtsitrin
Copy link
Collaborator

@mtsitrin mtsitrin commented Dec 3, 2024

  • x/gamm

    • simplifies code - no explicit swap before sending to x/txfees (wasn't used anyway)
  • x/txfees

    • separate swapFeeToBaseDenom from community pool logic
    • calls k.poolManager.RouteExactAmountIn with cacheCtx to drop the internal events

@mtsitrin mtsitrin linked an issue Dec 3, 2024 that may be closed by this pull request
@mtsitrin mtsitrin requested a review from omritoptix December 3, 2024 14:52
@@ -17,57 +15,17 @@ func (k Keeper) chargeTakerFee(
ctx sdk.Context,
takerFeeCoin sdk.Coin,
sender sdk.AccAddress,
route poolmanagertypes.SwapAmountInRoute,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chargeTakerFee used to swap if it's unknown denom.
as we don't expect pools with non-dym, we don't need this logic.
And if we would like it in the future, it needs to be part of the x/txfees logic anyway

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's correct we don't expect pools with non-dym.
we may have usdc pools.

@@ -128,44 +131,44 @@ func ValueFromPtr[T any](ptr *T) (zero T) {
}

// swapFeeToBaseDenom swaps the taker fee coin to the base denom.
// If the fee token is unknown, it is sent to the community pool.
// Returns error if the fee token is unknown or if swapping fails.
// The fee must be sent to the txfees module account beforehand.
func (k Keeper) swapFeeToBaseDenom(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swapFeeToBaseDenom was cleaned of the communityPool logic.
now handled by caller, based on returned err

@mtsitrin mtsitrin requested a review from ItzhakBokris December 4, 2024 08:07
@mtsitrin mtsitrin marked this pull request as draft December 4, 2024 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove taker fee swap from trade events
2 participants