types

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeWasmCallEvm = "wasm_call_evm"
	EventTypeEvmCallWasm = "evm_call_wasm"
	EventTypeEvmSendWasm = "evm_send_wasm"
	AttributeResult      = "result"
)
View Source
const (
	// ModuleName is the name of the contract module
	ModuleName = "vmbridge"

	// StoreKey is the string store representation
	StoreKey = ModuleName

	// TStoreKey is the string transient store representation
	TStoreKey = "transient_" + ModuleName

	// QuerierRoute is the querier route for the wasm module
	QuerierRoute = ModuleName

	// RouterKey is the msg router key for the wasm module
	RouterKey = ModuleName
)
View Source
const (
	PrecompileCallToWasm  = "callToWasm"
	PrecompileQueryToWasm = "queryToWasm"
)
View Source
const (
	SendToWasmEventName  = "__OKBCSendToWasm"
	WasmCalledMethodName = "mintCW20"

	SendToEvmSubMsgName = "send-to-evm"
	EvmCalledMethodName = "mintERC20"

	CallToWasmEventName = "__OKBCCallToWasm"

	WasmEvent2EvmMsgName = "call-to-wasm"
)

Variables

View Source
var (
	// ErrChainConfigNotFound returns an error if the chain config cannot be found on the store.
	ErrChainConfigNotFound = sdkerrors.Register(ModuleName, 1, "chain configuration not found")

	ErrCallerOfEvmEmpty = sdkerrors.Register(ModuleName, 2, "the caller of evm can not be nil")

	ErrCannotCreate = sdkerrors.Register(ModuleName, 3, "create is not supprot for vmbridge")

	ErrIsNotWasmAddr = sdkerrors.Register(ModuleName, 4, "call wasm contract must use wasmaddress")
	ErrIsNotEvmAddr  = sdkerrors.Register(ModuleName, 5, "call evm contract must use evmaddress")

	ErrAmountNegative   = sdkerrors.Register(ModuleName, 6, "the amount can not negative")
	ErrEvmExecuteFailed = sdkerrors.Register(ModuleName, 7, "the evm execute")

	ErrVMBridgeEnable = sdkerrors.Register(ModuleName, 8, "the vmbridge is disable")
	ErrIsNotOKBCAddr  = sdkerrors.Register(ModuleName, 9, "the address prefix must be ex")
	ErrIsNotETHAddr   = sdkerrors.Register(ModuleName, 10, "the address prefix must be 0x")
)
View Source
var (
	// SendToWasmEvent represent the signature of
	// `event __SendToWasm(string wasmAddr,string recipient, string amount)`
	SendToWasmEvent abi.Event

	// CallToWasmEvent represent the signature of
	// `event __OKBCCallToWasm(string wasmAddr,uint256 value, string calldata)`
	CallToWasmEvent abi.Event

	EvmABI abi.ABI
)
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 (
	PreCompileABI evm_types.ABI
)

Functions

func DecodePrecompileCallToWasmInput added in v0.1.6

func DecodePrecompileCallToWasmInput(input []byte) (wasmAddr, calldata string, err error)

func DecodePrecompileQueryToWasmInput added in v0.1.6

func DecodePrecompileQueryToWasmInput(input []byte) (calldata string, err error)

func EncodePrecompileCallToWasmOutput added in v0.1.6

func EncodePrecompileCallToWasmOutput(response string) ([]byte, error)

func EncodePrecompileQueryToWasmOutput added in v0.1.6

func EncodePrecompileQueryToWasmOutput(response string) ([]byte, error)

func ErrMsgSendToEvm

func ErrMsgSendToEvm(str string) sdk.EnvelopedErr

func GetEVMABIConfig

func GetEVMABIConfig(data []byte) (abi.ABI, abi.Event, abi.Event)

func GetMethodByIdFromCallData added in v0.1.6

func GetMethodByIdFromCallData(calldata []byte) (*abi.Method, error)

func GetMintCW20Input

func GetMintCW20Input(amount, recipient string) ([]byte, error)

func GetMintERC20Input

func GetMintERC20Input(callerAddr string, recipient common.Address, amount *big.Int) ([]byte, error)

func GetMintERC20Output

func GetMintERC20Output(data []byte) (bool, error)

func GetPreCompileABI added in v0.1.6

func GetPreCompileABI(data []byte) evm_types.ABI

func GetWasmVMQueryRequest added in v0.1.6

func GetWasmVMQueryRequest(requestData []byte) (*wasmvmtypes.QueryRequest, error)

func RegisterInterface

func RegisterInterface(registry interfacetypes.InterfaceRegistry)

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

Types

type MintCW20Method

type MintCW20Method struct {
	Amount    string `json:"amount"`
	Recipient string `json:"recipient"`
}

type MsgCallToEvm added in v0.1.2

type MsgCallToEvm struct {
	// Sender is the that actor that signed the messages
	Sender   string  `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender"`
	Evmaddr  string  `protobuf:"bytes,2,opt,name=evmaddr,proto3" json:"evmaddr"`
	Calldata string  `protobuf:"bytes,3,opt,name=calldata,proto3" json:"calldata"`
	Value    sdk.Int `protobuf:"bytes,4,opt,name=value,proto3,customtype=Int" json:"value"`
}

MsgStoreCode submit Wasm code to the system

func (*MsgCallToEvm) Descriptor added in v0.1.2

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

func (MsgCallToEvm) GetSignBytes added in v0.1.2

func (msg MsgCallToEvm) GetSignBytes() []byte

func (MsgCallToEvm) GetSigners added in v0.1.2

func (msg MsgCallToEvm) GetSigners() []sdk.AccAddress

func (*MsgCallToEvm) Marshal added in v0.1.2

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

func (*MsgCallToEvm) MarshalTo added in v0.1.2

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

func (*MsgCallToEvm) MarshalToSizedBuffer added in v0.1.2

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

func (*MsgCallToEvm) ProtoMessage added in v0.1.2

func (*MsgCallToEvm) ProtoMessage()

func (*MsgCallToEvm) Reset added in v0.1.2

func (m *MsgCallToEvm) Reset()

func (MsgCallToEvm) Route added in v0.1.2

func (msg MsgCallToEvm) Route() string

func (*MsgCallToEvm) Size added in v0.1.2

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

func (*MsgCallToEvm) String added in v0.1.2

func (m *MsgCallToEvm) String() string

func (MsgCallToEvm) Type added in v0.1.2

func (msg MsgCallToEvm) Type() string

func (*MsgCallToEvm) Unmarshal added in v0.1.2

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

func (MsgCallToEvm) ValidateBasic added in v0.1.2

func (msg MsgCallToEvm) ValidateBasic() error

func (*MsgCallToEvm) XXX_DiscardUnknown added in v0.1.2

func (m *MsgCallToEvm) XXX_DiscardUnknown()

func (*MsgCallToEvm) XXX_Marshal added in v0.1.2

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

func (*MsgCallToEvm) XXX_Merge added in v0.1.2

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

func (*MsgCallToEvm) XXX_Size added in v0.1.2

func (m *MsgCallToEvm) XXX_Size() int

func (*MsgCallToEvm) XXX_Unmarshal added in v0.1.2

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

type MsgCallToEvmResponse added in v0.1.2

type MsgCallToEvmResponse struct {
	// CodeID is the reference to the stored WASM code
	Response string `protobuf:"bytes,1,opt,name=response,proto3" json:"response"`
}

MsgStoreCodeResponse returns store result data.

func (*MsgCallToEvmResponse) Descriptor added in v0.1.2

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

func (*MsgCallToEvmResponse) Marshal added in v0.1.2

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

func (*MsgCallToEvmResponse) MarshalTo added in v0.1.2

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

func (*MsgCallToEvmResponse) MarshalToSizedBuffer added in v0.1.2

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

func (*MsgCallToEvmResponse) ProtoMessage added in v0.1.2

func (*MsgCallToEvmResponse) ProtoMessage()

func (*MsgCallToEvmResponse) Reset added in v0.1.2

func (m *MsgCallToEvmResponse) Reset()

func (*MsgCallToEvmResponse) Size added in v0.1.2

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

func (*MsgCallToEvmResponse) String added in v0.1.2

func (m *MsgCallToEvmResponse) String() string

func (*MsgCallToEvmResponse) Unmarshal added in v0.1.2

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

func (*MsgCallToEvmResponse) XXX_DiscardUnknown added in v0.1.2

func (m *MsgCallToEvmResponse) XXX_DiscardUnknown()

func (*MsgCallToEvmResponse) XXX_Marshal added in v0.1.2

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

func (*MsgCallToEvmResponse) XXX_Merge added in v0.1.2

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

func (*MsgCallToEvmResponse) XXX_Size added in v0.1.2

func (m *MsgCallToEvmResponse) XXX_Size() int

func (*MsgCallToEvmResponse) XXX_Unmarshal added in v0.1.2

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

type MsgClient

type MsgClient interface {
	// SendToEvmEvent to exchange cw20 to erc20
	SendToEvmEvent(ctx context.Context, in *MsgSendToEvm, opts ...grpc.CallOption) (*MsgSendToEvmResponse, error)
	// CallToEvmEvent to call to evm contract
	CallToEvmEvent(ctx context.Context, in *MsgCallToEvm, opts ...grpc.CallOption) (*MsgCallToEvmResponse, 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 MsgSendToEvm

type MsgSendToEvm struct {
	// Sender is the that actor that signed the messages
	Sender    string  `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender"`
	Contract  string  `protobuf:"bytes,2,opt,name=contract,proto3" json:"contract"`
	Recipient string  `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient"`
	Amount    sdk.Int `protobuf:"bytes,4,opt,name=amount,proto3,customtype=Int" json:"amount"`
}

MsgStoreCode submit Wasm code to the system

func (*MsgSendToEvm) Descriptor

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

func (MsgSendToEvm) GetSignBytes

func (msg MsgSendToEvm) GetSignBytes() []byte

func (MsgSendToEvm) GetSigners

func (msg MsgSendToEvm) GetSigners() []sdk.AccAddress

func (*MsgSendToEvm) Marshal

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

func (*MsgSendToEvm) MarshalTo

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

func (*MsgSendToEvm) MarshalToSizedBuffer

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

func (*MsgSendToEvm) ProtoMessage

func (*MsgSendToEvm) ProtoMessage()

func (*MsgSendToEvm) Reset

func (m *MsgSendToEvm) Reset()

func (MsgSendToEvm) Route

func (msg MsgSendToEvm) Route() string

func (*MsgSendToEvm) Size

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

func (*MsgSendToEvm) String

func (m *MsgSendToEvm) String() string

func (MsgSendToEvm) Type

func (msg MsgSendToEvm) Type() string

func (*MsgSendToEvm) Unmarshal

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

func (MsgSendToEvm) ValidateBasic

func (msg MsgSendToEvm) ValidateBasic() error

func (*MsgSendToEvm) XXX_DiscardUnknown

func (m *MsgSendToEvm) XXX_DiscardUnknown()

func (*MsgSendToEvm) XXX_Marshal

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

func (*MsgSendToEvm) XXX_Merge

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

func (*MsgSendToEvm) XXX_Size

func (m *MsgSendToEvm) XXX_Size() int

func (*MsgSendToEvm) XXX_Unmarshal

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

type MsgSendToEvmResponse

type MsgSendToEvmResponse struct {
	// CodeID is the reference to the stored WASM code
	Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
}

MsgStoreCodeResponse returns store result data.

func (*MsgSendToEvmResponse) Descriptor

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

func (*MsgSendToEvmResponse) Marshal

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

func (*MsgSendToEvmResponse) MarshalTo

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

func (*MsgSendToEvmResponse) MarshalToSizedBuffer

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

func (*MsgSendToEvmResponse) ProtoMessage

func (*MsgSendToEvmResponse) ProtoMessage()

func (*MsgSendToEvmResponse) Reset

func (m *MsgSendToEvmResponse) Reset()

func (*MsgSendToEvmResponse) Size

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

func (*MsgSendToEvmResponse) String

func (m *MsgSendToEvmResponse) String() string

func (*MsgSendToEvmResponse) Unmarshal

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

func (*MsgSendToEvmResponse) XXX_DiscardUnknown

func (m *MsgSendToEvmResponse) XXX_DiscardUnknown()

func (*MsgSendToEvmResponse) XXX_Marshal

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

func (*MsgSendToEvmResponse) XXX_Merge

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

func (*MsgSendToEvmResponse) XXX_Size

func (m *MsgSendToEvmResponse) XXX_Size() int

func (*MsgSendToEvmResponse) XXX_Unmarshal

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

type MsgServer

type MsgServer interface {
	// SendToEvmEvent to exchange cw20 to erc20
	SendToEvmEvent(context.Context, *MsgSendToEvm) (*MsgSendToEvmResponse, error)
	// CallToEvmEvent to call to evm contract
	CallToEvmEvent(context.Context, *MsgCallToEvm) (*MsgCallToEvmResponse, error)
}

MsgServer is the server API for Msg service.

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) CallToEvmEvent added in v0.1.2

func (*UnimplementedMsgServer) SendToEvmEvent

Jump to

Keyboard shortcuts

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