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

feat: taker fee should be passed to txfees module #32

Merged

Conversation

mtsitrin
Copy link
Collaborator

@mtsitrin mtsitrin commented Dec 6, 2023

This PR simplifies the taker fee logic once the txfee module is available.

taker fee checked vs the supported fees on txfee module.
if not supported, it will be swapped on the first pool on the route (to get a whitelisted pool asset)
than it sent to the txfee module to be burned

@mtsitrin mtsitrin changed the base branch from main to main-dym December 6, 2023 14:20
@mtsitrin mtsitrin changed the base branch from main-dym to txfees December 6, 2023 14:20
@mtsitrin mtsitrin marked this pull request as ready for review December 6, 2023 14:20
Copy link
Collaborator Author

@mtsitrin mtsitrin Dec 6, 2023

Choose a reason for hiding this comment

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

tokenInDenom string,
swapFee sdk.Dec,
) (tokenIn sdk.Coin, err error)
type SwapRoutesUnion struct {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

union struct so we could have common API for taker fee from both SwapIn and SwapOut

func (k *Keeper) SetPoolManager(poolManager types.PoolManager) {
k.poolManager = poolManager
}

// SetTxFees sets the tx fees keeper.
// must be called when initializing the keeper.
func (k *Keeper) SetTxFees(txfees types.TxFeeKeeper) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is it not being initialized when we init the keeper?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

theres a dependecy cycle
someone needs to be initialized first

OutRoutes: nil,
Type: "in",
}
err = server.keeper.chargeTakerFee(ctx, takerFeesCoins, sender, routesForTakerFee, msg.Routes[len(msg.Routes)-1].TokenOutDenom)
Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't it supposed to be msg.Routes[0].TokenOutDenom to get the out token of the first people given that it's an "in" route and this msg.Routes[len(msg.Routes)-1] should be for the Out route?

@mtsitrin mtsitrin merged commit 5b0d85d into txfees Dec 7, 2023
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.

2 participants