-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: taker fee should be passed to txfees module #32
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extracted from x/poolmanager/types/routes.go
x/poolmanager/types/routes.go
Outdated
tokenInDenom string, | ||
swapFee sdk.Dec, | ||
) (tokenIn sdk.Coin, err error) | ||
type SwapRoutesUnion struct { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
x/gamm/keeper/msg_server.go
Outdated
OutRoutes: nil, | ||
Type: "in", | ||
} | ||
err = server.keeper.chargeTakerFee(ctx, takerFeesCoins, sender, routesForTakerFee, msg.Routes[len(msg.Routes)-1].TokenOutDenom) |
There was a problem hiding this comment.
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?
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