types

package
v1.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName = "ibchooks"
	RouterKey  = ModuleName
	StoreKey   = "hooks-for-ibc" // not using the module name because of collisions with key "ibc"

	IBCCallbackKey = "ibc_callback"
	IBCAsyncAckKey = "ibc_async_ack"

	MsgEmitAckKey           = "emit_ack"
	AttributeSender         = "sender"
	AttributeChannel        = "channel"
	AttributePacketSequence = "sequence"

	SenderPrefix = "ibc-wasm-hook-intermediary"
)
View Source
const (
	TypeMsgEmitIBCAck = "emit-ibc-ack"
)

constants.

Variables

View Source
var (
	ErrBadMetadataFormatMsg = "wasm metadata not properly formatted for: '%v'. %s"
	ErrBadExecutionMsg      = "cannot execute contract: %v"

	ErrMsgValidation       = errorsmod.Register("wasm-hooks", 2, "error in wasmhook message validation")
	ErrMarshaling          = errorsmod.Register("wasm-hooks", 3, "cannot marshal the ICS20 packet")
	ErrInvalidPacket       = errorsmod.Register("wasm-hooks", 4, "invalid packet data")
	ErrBadResponse         = errorsmod.Register("wasm-hooks", 5, "cannot create response")
	ErrWasmError           = errorsmod.Register("wasm-hooks", 6, "wasm error")
	ErrBadSender           = errorsmod.Register("wasm-hooks", 7, "bad sender")
	ErrAckFromContract     = errorsmod.Register("wasm-hooks", 8, "contract returned error ack")
	ErrAsyncAckNotAllowed  = errorsmod.Register("wasm-hooks", 9, "contract not allowed to send async acks")
	ErrAckPacketMismatch   = errorsmod.Register("wasm-hooks", 10, "packet does not match the expected packet")
	ErrInvalidContractAddr = errorsmod.Register("wasm-hooks", 11, "invalid contract address")
	ErrMarkerError         = errorsmod.Register("marker-hooks", 12, "marker error")
)
View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthParams        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowParams          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	KeyAsyncAckAllowList = []byte("AsyncAckAllowList")
)

Parameter store keys.

Functions

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

func RegisterCodec

func RegisterCodec(cdc *codec.LegacyAmino)

func RegisterInterfaces

func RegisterInterfaces(registry types.InterfaceRegistry)

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

Types

type ChannelKeeper

type ChannelKeeper interface {
	GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool)
	GetPacketCommitment(ctx sdk.Context, portID, channelID string, sequence uint64) []byte
	GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
	LookupModuleByChannel(ctx sdk.Context, portID, channelID string) (string, *capabilitytypes.Capability, error)
	WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet exported.PacketI, acknowledgement exported.Acknowledgement) error
}

type ContractAck

type ContractAck struct {
	ContractResult []byte `json:"contract_result"`
	IbcAck         []byte `json:"ibc_ack"`
}

ContractAck is the response to be stored when a wasm hook is executed

type GenesisState

type GenesisState struct {
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

GenesisState is the IBC Hooks genesis state (params)

func DefaultGenesis

func DefaultGenesis() *GenesisState

DefaultGenesis returns the default GenesisState for the concentrated-liquidity module.

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type IBCAck

type IBCAck struct {
	Type    string          `json:"type"`
	Content json.RawMessage `json:"content"`
	// Note: These two fields have to be pointers so that they can be null
	// If they are not pointers, they will be empty structs when null,
	// which will cause issues with json.Unmarshal.
	AckResponse *IBCAckResponse `json:"response,omitempty"`
	AckError    *IBCAckError    `json:"error,omitempty"`
}

IBCAck is the parent IBC ack response structure

func UnmarshalIBCAck

func UnmarshalIBCAck(bz []byte) (*IBCAck, error)

UnmarshalIBCAck unmashals Ack to either response or error type

type IBCAckError

type IBCAckError struct {
	Packet           channeltypes.Packet `json:"packet"`
	ErrorDescription string              `json:"error_description"`
	ErrorResponse    string              `json:"error_response"`
}

IBCAckError is the error that a contract returns from the sudo() call on RequestAck

type IBCAckResponse

type IBCAckResponse struct {
	Packet      channeltypes.Packet `json:"packet"`
	ContractAck ContractAck         `json:"contract_ack"`
}

IBCAckResponse is the response that a contract returns from the sudo() call on OnRecvPacket or RequestAck

type IBCAsync

type IBCAsync struct {
	RequestAck `json:"ibc_async"`
}

IBCAsync is the sudo message to be sent to the contract for it to generate an ack for a sent packet

type IbcAck

type IbcAck struct {
	Channel  string    `json:"channel"`
	Sequence uint64    `json:"sequence"`
	Ack      JSONBytes `json:"ack"`
	Success  bool      `json:"success"`
}

IbcAck ibc ack struct with json fields defined

type IbcLifecycleComplete

type IbcLifecycleComplete struct {
	IbcLifecycleComplete interface{} `json:"ibc_lifecycle_complete"`
}

IbcLifecycleComplete ibc lifecycle complete struct with json fields defined

func NewIbcLifecycleCompleteAck

func NewIbcLifecycleCompleteAck(sourceChannel string, sequence uint64, ackAsJSON []byte, success bool) IbcLifecycleComplete

NewIbcLifecycleCompleteAck returns a new ibc lifecycle complete acknowledgment object for json serialization

func NewIbcLifecycleCompleteTimeout

func NewIbcLifecycleCompleteTimeout(sourceChannel string, sequence uint64) IbcLifecycleComplete

NewIbcLifecycleCompleteTimeout return a new ibc lifecycle complete timeout object for json serialization

type IbcLifecycleCompleteAck

type IbcLifecycleCompleteAck struct {
	IbcAck IbcAck `json:"ibc_ack"`
}

IbcLifecycleCompleteAck ibc lifcycle complete ack with json fields defined

type IbcLifecycleCompleteTimeout

type IbcLifecycleCompleteTimeout struct {
	IbcTimeout IbcTimeout `json:"ibc_timeout"`
}

IbcLifecycleCompleteTimeout ibc lifecycle complete struct with json fields defined

type IbcTimeout

type IbcTimeout struct {
	Channel  string `json:"channel"`
	Sequence uint64 `json:"sequence"`
}

IbcTimeout ibc timeout struct with json fields defined

type JSONBytes

type JSONBytes []byte

JSONBytes is a byte array of a json string

func (JSONBytes) MarshalJSON

func (jb JSONBytes) MarshalJSON() ([]byte, error)

MarshalJSON returns empty json object bytes when bytes are empty

type MarkerMemo

type MarkerMemo struct {
	Marker MarkerPayload `json:"marker"`
}

MarkerMemo parent marker struct for memo json

type MarkerPayload

type MarkerPayload struct {
	TransferAuths      []string `json:"transfer-auths"`
	AllowForceTransfer bool     `json:"allow-force-transfer"`
}

MarkerPayload child structure for marker memo

func NewMarkerPayload

func NewMarkerPayload(transferAuthAddrs []sdk.AccAddress, allowForceTransfer bool) MarkerPayload

NewMarkerPayload returns a marker payload with transfer authorities and allow force transfer flag

type MsgClient

type MsgClient interface {
	// EmitIBCAck checks the sender can emit the ack and writes the IBC
	// acknowledgement
	EmitIBCAck(ctx context.Context, in *MsgEmitIBCAck, opts ...grpc.CallOption) (*MsgEmitIBCAckResponse, error)
}

MsgClient is the client API for Msg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgEmitIBCAck

type MsgEmitIBCAck struct {
	Sender         string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"`
	PacketSequence uint64 `` /* 127-byte string literal not displayed */
	Channel        string `protobuf:"bytes,3,opt,name=channel,proto3" json:"channel,omitempty" yaml:"channel"`
}

MsgEmitIBCAck is the IBC Acknowledgement

func (*MsgEmitIBCAck) Descriptor

func (*MsgEmitIBCAck) Descriptor() ([]byte, []int)

func (*MsgEmitIBCAck) GetChannel

func (m *MsgEmitIBCAck) GetChannel() string

func (*MsgEmitIBCAck) GetPacketSequence

func (m *MsgEmitIBCAck) GetPacketSequence() uint64

func (*MsgEmitIBCAck) GetSender

func (m *MsgEmitIBCAck) GetSender() string

func (MsgEmitIBCAck) GetSignBytes

func (m MsgEmitIBCAck) GetSignBytes() []byte

func (MsgEmitIBCAck) GetSigners

func (m MsgEmitIBCAck) GetSigners() []sdk.AccAddress

func (*MsgEmitIBCAck) Marshal

func (m *MsgEmitIBCAck) Marshal() (dAtA []byte, err error)

func (*MsgEmitIBCAck) MarshalTo

func (m *MsgEmitIBCAck) MarshalTo(dAtA []byte) (int, error)

func (*MsgEmitIBCAck) MarshalToSizedBuffer

func (m *MsgEmitIBCAck) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgEmitIBCAck) ProtoMessage

func (*MsgEmitIBCAck) ProtoMessage()

func (*MsgEmitIBCAck) Reset

func (m *MsgEmitIBCAck) Reset()

func (MsgEmitIBCAck) Route

func (m MsgEmitIBCAck) Route() string

func (*MsgEmitIBCAck) Size

func (m *MsgEmitIBCAck) Size() (n int)

func (*MsgEmitIBCAck) String

func (m *MsgEmitIBCAck) String() string

func (MsgEmitIBCAck) Type

func (m MsgEmitIBCAck) Type() string

func (*MsgEmitIBCAck) Unmarshal

func (m *MsgEmitIBCAck) Unmarshal(dAtA []byte) error

func (MsgEmitIBCAck) ValidateBasic

func (m MsgEmitIBCAck) ValidateBasic() error

func (*MsgEmitIBCAck) XXX_DiscardUnknown

func (m *MsgEmitIBCAck) XXX_DiscardUnknown()

func (*MsgEmitIBCAck) XXX_Marshal

func (m *MsgEmitIBCAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgEmitIBCAck) XXX_Merge

func (m *MsgEmitIBCAck) XXX_Merge(src proto.Message)

func (*MsgEmitIBCAck) XXX_Size

func (m *MsgEmitIBCAck) XXX_Size() int

func (*MsgEmitIBCAck) XXX_Unmarshal

func (m *MsgEmitIBCAck) XXX_Unmarshal(b []byte) error

type MsgEmitIBCAckResponse

type MsgEmitIBCAckResponse struct {
	ContractResult string `` /* 126-byte string literal not displayed */
	IbcAck         string `protobuf:"bytes,2,opt,name=ibc_ack,json=ibcAck,proto3" json:"ibc_ack,omitempty" yaml:"ibc_ack"`
}

MsgEmitIBCAckResponse is the IBC Acknowledgement response

func (*MsgEmitIBCAckResponse) Descriptor

func (*MsgEmitIBCAckResponse) Descriptor() ([]byte, []int)

func (*MsgEmitIBCAckResponse) GetContractResult

func (m *MsgEmitIBCAckResponse) GetContractResult() string

func (*MsgEmitIBCAckResponse) GetIbcAck

func (m *MsgEmitIBCAckResponse) GetIbcAck() string

func (*MsgEmitIBCAckResponse) Marshal

func (m *MsgEmitIBCAckResponse) Marshal() (dAtA []byte, err error)

func (*MsgEmitIBCAckResponse) MarshalTo

func (m *MsgEmitIBCAckResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgEmitIBCAckResponse) MarshalToSizedBuffer

func (m *MsgEmitIBCAckResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgEmitIBCAckResponse) ProtoMessage

func (*MsgEmitIBCAckResponse) ProtoMessage()

func (*MsgEmitIBCAckResponse) Reset

func (m *MsgEmitIBCAckResponse) Reset()

func (*MsgEmitIBCAckResponse) Size

func (m *MsgEmitIBCAckResponse) Size() (n int)

func (*MsgEmitIBCAckResponse) String

func (m *MsgEmitIBCAckResponse) String() string

func (*MsgEmitIBCAckResponse) Unmarshal

func (m *MsgEmitIBCAckResponse) Unmarshal(dAtA []byte) error

func (*MsgEmitIBCAckResponse) XXX_DiscardUnknown

func (m *MsgEmitIBCAckResponse) XXX_DiscardUnknown()

func (*MsgEmitIBCAckResponse) XXX_Marshal

func (m *MsgEmitIBCAckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgEmitIBCAckResponse) XXX_Merge

func (m *MsgEmitIBCAckResponse) XXX_Merge(src proto.Message)

func (*MsgEmitIBCAckResponse) XXX_Size

func (m *MsgEmitIBCAckResponse) XXX_Size() int

func (*MsgEmitIBCAckResponse) XXX_Unmarshal

func (m *MsgEmitIBCAckResponse) XXX_Unmarshal(b []byte) error

type MsgServer

type MsgServer interface {
	// EmitIBCAck checks the sender can emit the ack and writes the IBC
	// acknowledgement
	EmitIBCAck(context.Context, *MsgEmitIBCAck) (*MsgEmitIBCAckResponse, error)
}

MsgServer is the server API for Msg service.

type OnRecvPacketAsyncAckResponse

type OnRecvPacketAsyncAckResponse struct {
	IsAsyncAck bool `json:"is_async_ack"`
}

OnRecvPacketAsyncAckResponse the response a contract sends to instruct the module to make the ack async

type Params

type Params struct {
	AllowedAsyncAckContracts []string `` /* 172-byte string literal not displayed */
}

Params defines the allowed async ack contracts

func DefaultParams

func DefaultParams() Params

DefaultParams returns default concentrated-liquidity module parameters.

func NewParams

func NewParams(allowedAsyncAckContracts []string) Params

func (*Params) Descriptor

func (*Params) Descriptor() ([]byte, []int)

func (*Params) GetAllowedAsyncAckContracts

func (m *Params) GetAllowedAsyncAckContracts() []string

func (*Params) Marshal

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs

ParamSetPairs implements params.ParamSet.

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

func (m *Params) Size() (n int)

func (*Params) String

func (m *Params) String() string

func (*Params) Unmarshal

func (m *Params) Unmarshal(dAtA []byte) error

func (Params) Validate

func (p Params) Validate() error

Validate params.

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

func (m *Params) XXX_Unmarshal(b []byte) error

type PreSendPacketDataProcessingFn

type PreSendPacketDataProcessingFn func(ctx sdk.Context, data []byte, processData map[string]interface{}) ([]byte, error)

PreSendPacketDataProcessingFn is function signature used for custom data processing before ibc's PacketSend executed in middleware

type RequestAck

type RequestAck struct {
	RequestAckI `json:"request_ack"`
}

RequestAck internals of IBCAsync

type RequestAckI

type RequestAckI struct {
	PacketSequence uint64 `json:"packet_sequence"`
	SourceChannel  string `json:"source_channel"`
}

RequestAckI internals of IBCAsync

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) EmitIBCAck

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL