-
Notifications
You must be signed in to change notification settings - Fork 586
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
Fee Middleware: Packet Callbacks #262
Comments
// OnRecvPacket implements the IBCModule interface.
func (am AppModule) OnRecvPacket(
ctx sdk.Context,
packet channeltypes.Packet,
relayer sdk.AccAddress,
) ibcexported.Acknowledgement {
// TODO: Implement fee specific logic if fee is enabled for the given channel
ack := am.app.OnRecvPacket(ctx, packet, relayer)
if !IsFeeEnabled() {
return ack
}
return constructIncentivizedAck(ack, relayer)
}
// OnAcknowledgementPacket implements the IBCModule interface
func (am AppModule) OnAcknowledgementPacket(
ctx sdk.Context,
packet channeltypes.Packet,
acknowledgement []byte,
relayer sdk.AccAddress,
) error {
// TODO: Implement fee specific logic if fee is enabled for the given channel
if am.keeper.IsFeeEnabled(packet.DestPort, packet.DestChannel) {
incentivized_ack := unmarshal(acknowledgment)
recvRelayer = getRecvRelayer(incentivized_ack)
recvFee := am.keeper.GetRecvFee(packet.DestPort, packet.DestChannel, packet.Sequence) // Sean creates this method
send(recvFee, recvRelayer) // from escrow address
// similar GetAckFee method
ackFee := am.keeper.GetAckFee(packet.DestPort, packet.DestChannel, packet.Sequence) // Sean creates this method
send(ackFee, relayer)
refund(timeoutFee)
}
return am.app.OnAcknowledgementPacket(ctx, packet, acknowledgement, relayer)
}
// OnTimeoutPacket implements the IBCModule interface
func (am AppModule) OnTimeoutPacket(
ctx sdk.Context,
packet channeltypes.Packet,
relayer sdk.AccAddress,
) error {
// TODO: Implement fee specific logic if fee is enabled for the given channel
if am.keeper.IsFeeEnabled() {
timeoutFee := am.keeper.GetTimeoutFee(packet.DestPort, packet.DestChannel, packet.Sequence) // Sean creates this method
send(timeoutFee, relayer)
recvFee := am.keeper.GetRecvFee(packet.DestPort, packet.DestChannel, packet.Sequence) // Sean creates this method
ackFee := am.keeper.GetAckFee(packet.DestPort, packet.DestChannel, packet.Sequence) // Sean creates this method
refund(ackFee)
refund(recvFee)
}
return am.app.OnTimeoutPacket(ctx, packet, relayer)
} |
CosmosCar
pushed a commit
to caelus-labs/ibc-go
that referenced
this issue
Nov 6, 2023
…-more Fix ineffective breaks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: