Skip to content

Commit

Permalink
Add comments and remove unused constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Witkowski committed Oct 30, 2023
1 parent 220e9b3 commit 5bc07e3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
8 changes: 4 additions & 4 deletions x/ibcratelimit/errors.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package ibcratelimit

import (
errorsmod "cosmossdk.io/errors"
cerrs "cosmossdk.io/errors"
)

var (
ErrRateLimitExceeded = errorsmod.Register(ModuleName, 2, "rate limit exceeded")
ErrBadMessage = errorsmod.Register(ModuleName, 3, "bad message")
ErrContractError = errorsmod.Register(ModuleName, 4, "contract error")
ErrRateLimitExceeded = cerrs.Register(ModuleName, 2, "rate limit exceeded")
ErrBadMessage = cerrs.Register(ModuleName, 3, "bad message")
ErrContractError = cerrs.Register(ModuleName, 4, "contract error")
)
8 changes: 5 additions & 3 deletions x/ibcratelimit/keys.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package ibcratelimit

const (
ModuleName = "ratelimitedibc" // IBC at the end to avoid conflicts with the ibc prefix
StoreKey = ModuleName
RouterKey = ModuleName
// ModuleName defines the module name
ModuleName = "ratelimitedibc"

// StoreKey defines the primary module store key
StoreKey = ModuleName
)

var (
Expand Down
1 change: 1 addition & 0 deletions x/ibcratelimit/module/ibc_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var (
_ porttypes.Middleware = &IBCMiddleware{}
)

// IBCMiddleware is the middleware used by the module.
type IBCMiddleware struct {
app porttypes.IBCModule
keeper *keeper.Keeper
Expand Down
8 changes: 8 additions & 0 deletions x/ibcratelimit/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,38 @@ import (
)

const (
// MsgSendPacket is the operation used for tracking a sent packet.
MsgSendPacket = "send_packet"
// MsgRecvPacket is the operation used for tracking a received packet.
MsgRecvPacket = "recv_packet"
)

// UndoSendMsg is an ibcratelimit contract message meant to undo tracked sends.
type UndoSendMsg struct {
UndoSend UndoPacketMsg `json:"undo_send"`
}

// UndoPacketMsg is an operation done by the UndoSendMsg.
type UndoPacketMsg struct {
Packet UnwrappedPacket `json:"packet"`
}

// SendPacketMsg is an ibcratelimit contract message meant to track sends.
type SendPacketMsg struct {
SendPacket PacketMsg `json:"send_packet"`
}

// RecvPacketMsg is an ibcratelimit contract message meant to track receives.
type RecvPacketMsg struct {
RecvPacket PacketMsg `json:"recv_packet"`
}

// PacketMsg contains
type PacketMsg struct {
Packet UnwrappedPacket `json:"packet"`
}

// UnwrappedPacket is a FungibleTokenPacket.
type UnwrappedPacket struct {
Sequence uint64 `json:"sequence"`
SourcePort string `json:"source_port"`
Expand Down

0 comments on commit 5bc07e3

Please sign in to comment.