mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-24 15:25:18 +00:00
feat(evmutil): add proto for MsgConvertNativeCoinToERC20 (#1595)
* add proto for MsgConvertNativeCoinToERC20 * implement Msg types & unit test validation
This commit is contained in:
parent
278f7854dc
commit
61c3aa090b
@ -266,6 +266,8 @@
|
||||
- [MsgConvertCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertCoinToERC20Response)
|
||||
- [MsgConvertERC20ToCoin](#kava.evmutil.v1beta1.MsgConvertERC20ToCoin)
|
||||
- [MsgConvertERC20ToCoinResponse](#kava.evmutil.v1beta1.MsgConvertERC20ToCoinResponse)
|
||||
- [MsgConvertNativeCoinToERC20](#kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20)
|
||||
- [MsgConvertNativeCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20Response)
|
||||
|
||||
- [Msg](#kava.evmutil.v1beta1.Msg)
|
||||
|
||||
@ -3883,6 +3885,33 @@ Msg/MsgConvertERC20ToCoin.
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20"></a>
|
||||
|
||||
### MsgConvertNativeCoinToERC20
|
||||
ConvertNativeCoinToERC20 defines a conversion from native sdk.Coin to ERC20.
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| `initiator` | [string](#string) | | Kava bech32 address initiating the conversion. |
|
||||
| `receiver` | [string](#string) | | EVM hex address that will receive the ERC20 tokens. |
|
||||
| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Amount is the sdk.Coin amount to convert. |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20Response"></a>
|
||||
|
||||
### MsgConvertNativeCoinToERC20Response
|
||||
MsgConvertNativeCoinToERC20Response defines the response value from Msg/MsgConvertNativeCoinToERC20.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- end messages -->
|
||||
|
||||
<!-- end enums -->
|
||||
@ -3899,6 +3928,7 @@ Msg defines the evmutil Msg service.
|
||||
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
|
||||
| `ConvertCoinToERC20` | [MsgConvertCoinToERC20](#kava.evmutil.v1beta1.MsgConvertCoinToERC20) | [MsgConvertCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertCoinToERC20Response) | ConvertCoinToERC20 defines a method for converting sdk.Coin to Kava ERC20. | |
|
||||
| `ConvertERC20ToCoin` | [MsgConvertERC20ToCoin](#kava.evmutil.v1beta1.MsgConvertERC20ToCoin) | [MsgConvertERC20ToCoinResponse](#kava.evmutil.v1beta1.MsgConvertERC20ToCoinResponse) | ConvertERC20ToCoin defines a method for converting Kava ERC20 to sdk.Coin. | |
|
||||
| `ConvertNativeCoinToERC20` | [MsgConvertNativeCoinToERC20](#kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20) | [MsgConvertNativeCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20Response) | ConvertNativeCoinToERC20 defines a method for converting a native sdk.Coin to an ERC20. | |
|
||||
|
||||
<!-- end services -->
|
||||
|
||||
|
@ -16,6 +16,9 @@ service Msg {
|
||||
|
||||
// ConvertERC20ToCoin defines a method for converting Kava ERC20 to sdk.Coin.
|
||||
rpc ConvertERC20ToCoin(MsgConvertERC20ToCoin) returns (MsgConvertERC20ToCoinResponse);
|
||||
|
||||
// ConvertNativeCoinToERC20 defines a method for converting a native sdk.Coin to an ERC20.
|
||||
rpc ConvertNativeCoinToERC20(MsgConvertNativeCoinToERC20) returns (MsgConvertNativeCoinToERC20Response);
|
||||
}
|
||||
|
||||
// MsgConvertCoinToERC20 defines a conversion from sdk.Coin to Kava ERC20.
|
||||
@ -50,3 +53,16 @@ message MsgConvertERC20ToCoin {
|
||||
// MsgConvertERC20ToCoinResponse defines the response value from
|
||||
// Msg/MsgConvertERC20ToCoin.
|
||||
message MsgConvertERC20ToCoinResponse {}
|
||||
|
||||
// ConvertNativeCoinToERC20 defines a conversion from native sdk.Coin to ERC20.
|
||||
message MsgConvertNativeCoinToERC20 {
|
||||
// Kava bech32 address initiating the conversion.
|
||||
string initiator = 1;
|
||||
// EVM hex address that will receive the ERC20 tokens.
|
||||
string receiver = 2;
|
||||
// Amount is the sdk.Coin amount to convert.
|
||||
cosmos.base.v1beta1.Coin amount = 3;
|
||||
}
|
||||
|
||||
// MsgConvertNativeCoinToERC20Response defines the response value from Msg/MsgConvertNativeCoinToERC20.
|
||||
message MsgConvertNativeCoinToERC20Response {}
|
||||
|
@ -94,7 +94,7 @@ func (suite *ERC20TestSuite) TestDeployKavaWrappedNativeCoinERC20Contract() {
|
||||
})
|
||||
|
||||
suite.Run("deploys contract with expected metadata & permissions", func() {
|
||||
caller, privKey := suite.RandomAccount()
|
||||
caller, privKey := testutil.RandomEvmAccount()
|
||||
|
||||
token := types.NewAllowedNativeCoinERC20Token("hard", "EVM HARD", "HARD", 6)
|
||||
addr, err := suite.Keeper.DeployKavaWrappedNativeCoinERC20Contract(suite.Ctx, token)
|
||||
|
@ -21,6 +21,10 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer {
|
||||
|
||||
var _ types.MsgServer = msgServer{}
|
||||
|
||||
////////////////////////////
|
||||
// EVM-native assets -> Cosmos SDK
|
||||
////////////////////////////
|
||||
|
||||
// ConvertCoinToERC20 handles a MsgConvertCoinToERC20 message to convert
|
||||
// sdk.Coin to Kava EVM tokens.
|
||||
func (s msgServer) ConvertCoinToERC20(
|
||||
@ -102,3 +106,17 @@ func (s msgServer) ConvertERC20ToCoin(
|
||||
|
||||
return &types.MsgConvertERC20ToCoinResponse{}, nil
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
// Cosmos SDK-native assets -> EVM
|
||||
////////////////////////////
|
||||
|
||||
// ConvertNativeCoinToERC20 converts a native sdk.Coin to an ERC20.
|
||||
// If no ERC20 contract has been deployed for the given denom, a new
|
||||
// contract will be deployed and registered to the module.
|
||||
func (msgServer) ConvertNativeCoinToERC20(
|
||||
ctx context.Context,
|
||||
msg *types.MsgConvertNativeCoinToERC20,
|
||||
) (*types.MsgConvertNativeCoinToERC20Response, error) {
|
||||
return nil, fmt.Errorf("unimplemented - coming soon")
|
||||
}
|
||||
|
@ -72,10 +72,10 @@ func (suite *Suite) SetupTest() {
|
||||
suite.EvmModuleAddr = suite.AccountKeeper.GetModuleAddress(evmtypes.ModuleName)
|
||||
|
||||
// test evm user keys that have no minting permissions
|
||||
addr, privKey := suite.RandomAccount()
|
||||
addr, privKey := RandomEvmAccount()
|
||||
suite.Key1 = privKey
|
||||
suite.Key1Addr = types.NewInternalEVMAddress(addr)
|
||||
_, suite.Key2 = suite.RandomAccount()
|
||||
_, suite.Key2 = RandomEvmAccount()
|
||||
|
||||
_, addrs := app.GeneratePrivKeyAddressPairs(4)
|
||||
suite.Addrs = addrs
|
||||
@ -180,13 +180,6 @@ func (suite *Suite) Commit() {
|
||||
suite.Ctx = suite.App.NewContext(false, header)
|
||||
}
|
||||
|
||||
func (suite *Suite) RandomAccount() (common.Address, *ethsecp256k1.PrivKey) {
|
||||
privKey, err := ethsecp256k1.GenerateKey()
|
||||
suite.NoError(err)
|
||||
addr := common.BytesToAddress(privKey.PubKey().Address())
|
||||
return addr, privKey
|
||||
}
|
||||
|
||||
func (suite *Suite) FundAccountWithKava(addr sdk.AccAddress, coins sdk.Coins) {
|
||||
ukava := coins.AmountOf("ukava")
|
||||
if ukava.IsPositive() {
|
||||
@ -409,3 +402,12 @@ func MustNewInternalEVMAddressFromString(addrStr string) types.InternalEVMAddres
|
||||
|
||||
return addr
|
||||
}
|
||||
|
||||
func RandomEvmAccount() (common.Address, *ethsecp256k1.PrivKey) {
|
||||
privKey, err := ethsecp256k1.GenerateKey()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
addr := common.BytesToAddress(privKey.PubKey().Address())
|
||||
return addr, privKey
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
///////////////
|
||||
// EVM -> SDK
|
||||
// EVM -> Cosmos SDK
|
||||
///////////////
|
||||
|
||||
// NewConversionPair returns a new ConversionPair.
|
||||
@ -95,7 +95,7 @@ func validateConversionPairs(i interface{}) error {
|
||||
}
|
||||
|
||||
///////////////
|
||||
// SDK -> EVM
|
||||
// Cosmos SDK -> EVM
|
||||
///////////////
|
||||
|
||||
// NewAllowedNativeCoinERC20Token returns an AllowedNativeCoinERC20Token
|
||||
|
@ -12,17 +12,26 @@ import (
|
||||
// ensure Msg interface compliance at compile time
|
||||
var (
|
||||
_ sdk.Msg = &MsgConvertCoinToERC20{}
|
||||
_ sdk.Msg = &MsgConvertERC20ToCoin{}
|
||||
_ legacytx.LegacyMsg = &MsgConvertCoinToERC20{}
|
||||
_ sdk.Msg = &MsgConvertERC20ToCoin{}
|
||||
_ legacytx.LegacyMsg = &MsgConvertERC20ToCoin{}
|
||||
|
||||
_ sdk.Msg = &MsgConvertNativeCoinToERC20{}
|
||||
_ legacytx.LegacyMsg = &MsgConvertNativeCoinToERC20{}
|
||||
)
|
||||
|
||||
// legacy message types
|
||||
const (
|
||||
TypeMsgConvertCoinToERC20 = "evmutil_convert_coin_to_erc20"
|
||||
TypeMsgConvertERC20ToCoin = "evmutil_convert_erc20_to_coin"
|
||||
|
||||
TypeMsgConvertNativeCoinToERC20 = "evmutil_convert_native_coin_to_erc20"
|
||||
)
|
||||
|
||||
////////////////////////////
|
||||
// EVM-native assets -> Cosmos SDK
|
||||
////////////////////////////
|
||||
|
||||
// NewMsgConvertCoinToERC20 returns a new MsgConvertCoinToERC20
|
||||
func NewMsgConvertCoinToERC20(
|
||||
initiator string,
|
||||
@ -146,3 +155,58 @@ func (msg MsgConvertERC20ToCoin) Route() string {
|
||||
func (msg MsgConvertERC20ToCoin) Type() string {
|
||||
return TypeMsgConvertERC20ToCoin
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
// Cosmos SDK-native assets -> EVM
|
||||
////////////////////////////
|
||||
|
||||
// NewMsgConvertNativeCoinToERC20 returns a new MsgConvertNativeCoinToERC20
|
||||
func NewMsgConvertNativeCoinToERC20(
|
||||
initiator string,
|
||||
receiver string,
|
||||
amount sdk.Coin,
|
||||
) MsgConvertNativeCoinToERC20 {
|
||||
return MsgConvertNativeCoinToERC20{
|
||||
Initiator: initiator,
|
||||
Receiver: receiver,
|
||||
Amount: &amount,
|
||||
}
|
||||
}
|
||||
|
||||
// GetSigners implements types.Msg
|
||||
func (msg MsgConvertNativeCoinToERC20) GetSigners() []sdk.AccAddress {
|
||||
sender, err := sdk.AccAddressFromBech32(msg.Initiator)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return []sdk.AccAddress{sender}
|
||||
}
|
||||
|
||||
// ValidateBasic implements types.Msg
|
||||
func (msg MsgConvertNativeCoinToERC20) ValidateBasic() error {
|
||||
_, err := sdk.AccAddressFromBech32(msg.Initiator)
|
||||
if err != nil {
|
||||
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid initiator address (%s): %s", msg.Initiator, err.Error())
|
||||
}
|
||||
|
||||
if !common.IsHexAddress(msg.Receiver) {
|
||||
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "receiver is not a valid hex address (%s)", msg.Receiver)
|
||||
}
|
||||
|
||||
if msg.Amount.IsNil() || !msg.Amount.IsValid() || msg.Amount.IsZero() {
|
||||
return errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "'%s'", msg.Amount)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSignBytes implements legacytx.LegacyMsg
|
||||
func (msg MsgConvertNativeCoinToERC20) GetSignBytes() []byte {
|
||||
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
|
||||
}
|
||||
|
||||
// Route implements legacytx.LegacyMsg
|
||||
func (MsgConvertNativeCoinToERC20) Route() string { return RouterKey }
|
||||
|
||||
// Type implements legacytx.LegacyMsg
|
||||
func (MsgConvertNativeCoinToERC20) Type() string { return TypeMsgConvertNativeCoinToERC20 }
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/kava-labs/kava/app"
|
||||
"github.com/kava-labs/kava/x/evmutil/testutil"
|
||||
"github.com/kava-labs/kava/x/evmutil/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
@ -198,3 +199,114 @@ func TestMsgConvertERC20ToCoin(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertNativeCoinToERC20_ValidateBasic(t *testing.T) {
|
||||
validKavaAddr := app.RandomAddress()
|
||||
validHexAddr, _ := testutil.RandomEvmAccount()
|
||||
invalidAddr := "not-an-address"
|
||||
validAmount := sdk.NewInt64Coin("hard", 5e3)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
initiator string
|
||||
receiver string
|
||||
amount sdk.Coin
|
||||
expectedErr string
|
||||
}{
|
||||
{
|
||||
name: "valid",
|
||||
initiator: validKavaAddr.String(),
|
||||
receiver: validHexAddr.String(),
|
||||
amount: validAmount,
|
||||
expectedErr: "",
|
||||
},
|
||||
{
|
||||
name: "invalid - sending to kava addr",
|
||||
initiator: validKavaAddr.String(),
|
||||
receiver: app.RandomAddress().String(),
|
||||
amount: validAmount,
|
||||
expectedErr: "receiver is not a valid hex address",
|
||||
},
|
||||
{
|
||||
name: "invalid - invalid initiator",
|
||||
initiator: invalidAddr,
|
||||
receiver: app.RandomAddress().String(),
|
||||
amount: validAmount,
|
||||
expectedErr: "invalid initiator address",
|
||||
},
|
||||
{
|
||||
name: "invalid - invalid receiver",
|
||||
initiator: validKavaAddr.String(),
|
||||
receiver: invalidAddr,
|
||||
amount: validAmount,
|
||||
expectedErr: "receiver is not a valid hex address",
|
||||
},
|
||||
{
|
||||
name: "invalid - invalid amount - nil",
|
||||
initiator: validKavaAddr.String(),
|
||||
receiver: validHexAddr.String(),
|
||||
amount: sdk.Coin{},
|
||||
expectedErr: "invalid coins",
|
||||
},
|
||||
{
|
||||
name: "invalid - invalid amount - zero",
|
||||
initiator: validKavaAddr.String(),
|
||||
receiver: validHexAddr.String(),
|
||||
amount: sdk.NewInt64Coin("magic", 0),
|
||||
expectedErr: "invalid coins",
|
||||
},
|
||||
{
|
||||
name: "invalid - invalid amount - negative",
|
||||
initiator: validKavaAddr.String(),
|
||||
receiver: validHexAddr.String(),
|
||||
amount: sdk.Coin{Denom: "magic", Amount: sdkmath.NewInt(-42)},
|
||||
expectedErr: "invalid coins",
|
||||
},
|
||||
{
|
||||
name: "invalid - invalid amount - invalid denom",
|
||||
initiator: validKavaAddr.String(),
|
||||
receiver: validHexAddr.String(),
|
||||
amount: sdk.Coin{Denom: "", Amount: sdkmath.NewInt(42)},
|
||||
expectedErr: "invalid coins",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
msg := types.NewMsgConvertNativeCoinToERC20(
|
||||
tc.initiator,
|
||||
tc.receiver,
|
||||
tc.amount,
|
||||
)
|
||||
err := msg.ValidateBasic()
|
||||
|
||||
if tc.expectedErr != "" {
|
||||
require.ErrorContains(t, err, tc.expectedErr)
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "evmutil", msg.Route())
|
||||
require.Equal(t, "evmutil_convert_native_coin_to_erc20", msg.Type())
|
||||
require.NotPanics(t, func() { _ = msg.GetSignBytes() })
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertNativeCoinToERC20_GetSigners(t *testing.T) {
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
initiator := app.RandomAddress()
|
||||
signers := types.MsgConvertNativeCoinToERC20{
|
||||
Initiator: initiator.String(),
|
||||
}.GetSigners()
|
||||
require.Len(t, signers, 1)
|
||||
require.Equal(t, initiator, signers[0])
|
||||
})
|
||||
|
||||
t.Run("panics when depositor is invalid", func(t *testing.T) {
|
||||
require.Panics(t, func() {
|
||||
types.MsgConvertNativeCoinToERC20{
|
||||
Initiator: "not-an-address",
|
||||
}.GetSigners()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -236,47 +236,153 @@ func (m *MsgConvertERC20ToCoinResponse) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_MsgConvertERC20ToCoinResponse proto.InternalMessageInfo
|
||||
|
||||
// ConvertNativeCoinToERC20 defines a conversion from native sdk.Coin to ERC20.
|
||||
type MsgConvertNativeCoinToERC20 struct {
|
||||
// Kava bech32 address initiating the conversion.
|
||||
Initiator string `protobuf:"bytes,1,opt,name=initiator,proto3" json:"initiator,omitempty"`
|
||||
// EVM hex address that will receive the ERC20 tokens.
|
||||
Receiver string `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"`
|
||||
// Amount is the sdk.Coin amount to convert.
|
||||
Amount *types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgConvertNativeCoinToERC20) Reset() { *m = MsgConvertNativeCoinToERC20{} }
|
||||
func (m *MsgConvertNativeCoinToERC20) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgConvertNativeCoinToERC20) ProtoMessage() {}
|
||||
func (*MsgConvertNativeCoinToERC20) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6e82783c6c58f89c, []int{4}
|
||||
}
|
||||
func (m *MsgConvertNativeCoinToERC20) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgConvertNativeCoinToERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgConvertNativeCoinToERC20.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *MsgConvertNativeCoinToERC20) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgConvertNativeCoinToERC20.Merge(m, src)
|
||||
}
|
||||
func (m *MsgConvertNativeCoinToERC20) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgConvertNativeCoinToERC20) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgConvertNativeCoinToERC20.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgConvertNativeCoinToERC20 proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgConvertNativeCoinToERC20) GetInitiator() string {
|
||||
if m != nil {
|
||||
return m.Initiator
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgConvertNativeCoinToERC20) GetReceiver() string {
|
||||
if m != nil {
|
||||
return m.Receiver
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgConvertNativeCoinToERC20) GetAmount() *types.Coin {
|
||||
if m != nil {
|
||||
return m.Amount
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MsgConvertNativeCoinToERC20Response defines the response value from Msg/MsgConvertNativeCoinToERC20.
|
||||
type MsgConvertNativeCoinToERC20Response struct {
|
||||
}
|
||||
|
||||
func (m *MsgConvertNativeCoinToERC20Response) Reset() { *m = MsgConvertNativeCoinToERC20Response{} }
|
||||
func (m *MsgConvertNativeCoinToERC20Response) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgConvertNativeCoinToERC20Response) ProtoMessage() {}
|
||||
func (*MsgConvertNativeCoinToERC20Response) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6e82783c6c58f89c, []int{5}
|
||||
}
|
||||
func (m *MsgConvertNativeCoinToERC20Response) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgConvertNativeCoinToERC20Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgConvertNativeCoinToERC20Response.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *MsgConvertNativeCoinToERC20Response) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgConvertNativeCoinToERC20Response.Merge(m, src)
|
||||
}
|
||||
func (m *MsgConvertNativeCoinToERC20Response) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgConvertNativeCoinToERC20Response) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgConvertNativeCoinToERC20Response.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgConvertNativeCoinToERC20Response proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MsgConvertCoinToERC20)(nil), "kava.evmutil.v1beta1.MsgConvertCoinToERC20")
|
||||
proto.RegisterType((*MsgConvertCoinToERC20Response)(nil), "kava.evmutil.v1beta1.MsgConvertCoinToERC20Response")
|
||||
proto.RegisterType((*MsgConvertERC20ToCoin)(nil), "kava.evmutil.v1beta1.MsgConvertERC20ToCoin")
|
||||
proto.RegisterType((*MsgConvertERC20ToCoinResponse)(nil), "kava.evmutil.v1beta1.MsgConvertERC20ToCoinResponse")
|
||||
proto.RegisterType((*MsgConvertNativeCoinToERC20)(nil), "kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20")
|
||||
proto.RegisterType((*MsgConvertNativeCoinToERC20Response)(nil), "kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20Response")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("kava/evmutil/v1beta1/tx.proto", fileDescriptor_6e82783c6c58f89c) }
|
||||
|
||||
var fileDescriptor_6e82783c6c58f89c = []byte{
|
||||
// 469 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xb1, 0x6e, 0x13, 0x31,
|
||||
0x18, 0x8e, 0x5b, 0x54, 0x11, 0xb3, 0x54, 0x56, 0x90, 0xd2, 0x88, 0x3a, 0x55, 0x06, 0x54, 0x84,
|
||||
0xe2, 0x6b, 0x52, 0xc4, 0xc4, 0x42, 0xa2, 0x0e, 0x55, 0xd5, 0xe5, 0xc8, 0xc4, 0x12, 0xf9, 0x2e,
|
||||
0xd6, 0x61, 0xb5, 0x67, 0x47, 0xb6, 0x73, 0x2a, 0x0f, 0xc0, 0xce, 0x13, 0x30, 0xf3, 0x00, 0x7d,
|
||||
0x88, 0x8e, 0x55, 0x27, 0xc4, 0x10, 0x95, 0xcb, 0x33, 0xb0, 0x23, 0xfb, 0x9c, 0xeb, 0x09, 0x4e,
|
||||
0x44, 0x9d, 0xce, 0xf6, 0xf7, 0xfd, 0xfe, 0xbf, 0xef, 0xfb, 0xcf, 0x70, 0xff, 0x82, 0x66, 0x34,
|
||||
0x60, 0x59, 0xba, 0x30, 0xfc, 0x32, 0xc8, 0x06, 0x11, 0x33, 0x74, 0x10, 0x98, 0x2b, 0x32, 0x57,
|
||||
0xd2, 0x48, 0xd4, 0xb2, 0x30, 0xf1, 0x30, 0xf1, 0x70, 0x07, 0xc7, 0x52, 0xa7, 0x52, 0x07, 0x11,
|
||||
0xd5, 0xac, 0xac, 0x89, 0x25, 0x17, 0x45, 0x55, 0x67, 0xaf, 0xc0, 0xa7, 0x6e, 0x17, 0x14, 0x1b,
|
||||
0x0f, 0xb5, 0x12, 0x99, 0xc8, 0xe2, 0xdc, 0xae, 0x8a, 0xd3, 0xde, 0x37, 0x00, 0x9f, 0x9f, 0xeb,
|
||||
0x64, 0x2c, 0x45, 0xc6, 0x94, 0x19, 0x4b, 0x2e, 0x26, 0xf2, 0x24, 0x1c, 0x0f, 0x8f, 0xd0, 0x5b,
|
||||
0xd8, 0xe4, 0x82, 0x1b, 0x4e, 0x8d, 0x54, 0x6d, 0x70, 0x00, 0x0e, 0x9b, 0xa3, 0xf6, 0xdd, 0x75,
|
||||
0xbf, 0xe5, 0x2f, 0x7d, 0x3f, 0x9b, 0x29, 0xa6, 0xf5, 0x07, 0xa3, 0xb8, 0x48, 0xc2, 0x07, 0x2a,
|
||||
0xea, 0xc0, 0xa7, 0x8a, 0xc5, 0x8c, 0x67, 0x4c, 0xb5, 0xb7, 0x6c, 0x59, 0x58, 0xee, 0xd1, 0x00,
|
||||
0xee, 0xd0, 0x54, 0x2e, 0x84, 0x69, 0x6f, 0x1f, 0x80, 0xc3, 0x67, 0xc3, 0x3d, 0xe2, 0x6f, 0xb3,
|
||||
0x7e, 0xd6, 0x26, 0x89, 0x55, 0x11, 0x7a, 0x62, 0xaf, 0x0b, 0xf7, 0x6b, 0xf5, 0x85, 0x4c, 0xcf,
|
||||
0xa5, 0xd0, 0xac, 0xf7, 0x65, 0xab, 0xea, 0xc0, 0x61, 0x13, 0x69, 0x89, 0xe8, 0xc5, 0x3f, 0x0e,
|
||||
0xaa, 0x3a, 0xdf, 0xfc, 0xad, 0xf3, 0x3f, 0xf6, 0x1e, 0x1c, 0x8c, 0x20, 0xb2, 0x83, 0x99, 0x32,
|
||||
0x15, 0x0f, 0x8f, 0xa6, 0xb4, 0x60, 0x39, 0x37, 0xcd, 0x51, 0x2b, 0x5f, 0x76, 0x77, 0xcf, 0x68,
|
||||
0x46, 0x9d, 0x08, 0x7f, 0x43, 0xb8, 0x6b, 0xf9, 0x27, 0x96, 0xee, 0x4f, 0xd0, 0xa4, 0x4c, 0xe1,
|
||||
0x89, 0xab, 0x7b, 0x77, 0xb3, 0xec, 0x36, 0x7e, 0x2e, 0xbb, 0x2f, 0x13, 0x6e, 0x3e, 0x2d, 0x22,
|
||||
0x12, 0xcb, 0xd4, 0x8f, 0xce, 0x7f, 0xfa, 0x7a, 0x76, 0x11, 0x98, 0xcf, 0x73, 0xa6, 0xc9, 0xa9,
|
||||
0x30, 0x77, 0xd7, 0x7d, 0xe8, 0x55, 0x9e, 0x0a, 0x53, 0x1f, 0x54, 0x25, 0x86, 0x75, 0x50, 0xc3,
|
||||
0xdf, 0x00, 0x6e, 0x9f, 0xeb, 0x04, 0x65, 0x10, 0xd5, 0x8c, 0xfb, 0x35, 0xa9, 0xfb, 0xe1, 0x48,
|
||||
0x6d, 0xf6, 0x9d, 0xe3, 0x47, 0x90, 0xd7, 0xfd, 0x2b, 0x7d, 0xab, 0x43, 0xda, 0xd8, 0xb7, 0x42,
|
||||
0xde, 0xdc, 0xb7, 0xc6, 0xf7, 0xe8, 0xec, 0xfe, 0x17, 0x06, 0xdf, 0x73, 0x0c, 0x6e, 0x72, 0x0c,
|
||||
0x6e, 0x73, 0x0c, 0xee, 0x73, 0x0c, 0xbe, 0xae, 0x70, 0xe3, 0x76, 0x85, 0x1b, 0x3f, 0x56, 0xb8,
|
||||
0xf1, 0xf1, 0x55, 0x25, 0x78, 0xdb, 0xa0, 0x7f, 0x49, 0x23, 0xed, 0x56, 0xc1, 0x55, 0xf9, 0x42,
|
||||
0x5d, 0xfe, 0xd1, 0x8e, 0x7b, 0x36, 0xc7, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x08, 0x7a, 0x44,
|
||||
0xee, 0xbe, 0x03, 0x00, 0x00,
|
||||
// 519 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x41, 0x6b, 0x13, 0x41,
|
||||
0x14, 0xce, 0x34, 0x52, 0xcc, 0x78, 0x29, 0x43, 0x84, 0xed, 0x6a, 0x37, 0x25, 0xa2, 0x54, 0x24,
|
||||
0xb3, 0x4d, 0x2a, 0x82, 0xe0, 0xc5, 0x84, 0x1e, 0x4a, 0xa9, 0x87, 0x35, 0x27, 0x2f, 0x61, 0x76,
|
||||
0x33, 0xac, 0x43, 0x9b, 0x99, 0xb0, 0x33, 0x59, 0xea, 0xcd, 0x8b, 0x20, 0x9e, 0xfc, 0x05, 0x9e,
|
||||
0xfd, 0x01, 0xfd, 0x11, 0x3d, 0x96, 0x9e, 0xc4, 0x43, 0xa8, 0x9b, 0x3f, 0x22, 0xb3, 0x3b, 0xd9,
|
||||
0x2c, 0x76, 0x4d, 0x08, 0xf4, 0xb4, 0x33, 0xef, 0x7d, 0xef, 0xbd, 0xef, 0x7b, 0xef, 0xed, 0xc0,
|
||||
0x9d, 0x53, 0x12, 0x13, 0x97, 0xc6, 0xa3, 0x89, 0x62, 0x67, 0x6e, 0xdc, 0xf6, 0xa9, 0x22, 0x6d,
|
||||
0x57, 0x9d, 0xe3, 0x71, 0x24, 0x94, 0x40, 0x75, 0xed, 0xc6, 0xc6, 0x8d, 0x8d, 0xdb, 0x76, 0x02,
|
||||
0x21, 0x47, 0x42, 0xba, 0x3e, 0x91, 0x34, 0x8f, 0x09, 0x04, 0xe3, 0x59, 0x94, 0xbd, 0x9d, 0xf9,
|
||||
0x07, 0xe9, 0xcd, 0xcd, 0x2e, 0xc6, 0x55, 0x0f, 0x45, 0x28, 0x32, 0xbb, 0x3e, 0x65, 0xd6, 0xe6,
|
||||
0x0f, 0x00, 0x1f, 0x9e, 0xc8, 0xb0, 0x27, 0x78, 0x4c, 0x23, 0xd5, 0x13, 0x8c, 0xf7, 0xc5, 0xa1,
|
||||
0xd7, 0xeb, 0xec, 0xa3, 0x57, 0xb0, 0xc6, 0x38, 0x53, 0x8c, 0x28, 0x11, 0x59, 0x60, 0x17, 0xec,
|
||||
0xd5, 0xba, 0xd6, 0xf5, 0x45, 0xab, 0x6e, 0x92, 0xbe, 0x1d, 0x0e, 0x23, 0x2a, 0xe5, 0x7b, 0x15,
|
||||
0x31, 0x1e, 0x7a, 0x0b, 0x28, 0xb2, 0xe1, 0xfd, 0x88, 0x06, 0x94, 0xc5, 0x34, 0xb2, 0x36, 0x74,
|
||||
0x98, 0x97, 0xdf, 0x51, 0x1b, 0x6e, 0x92, 0x91, 0x98, 0x70, 0x65, 0x55, 0x77, 0xc1, 0xde, 0x83,
|
||||
0xce, 0x36, 0x36, 0xd9, 0xb4, 0x9e, 0xb9, 0x48, 0xac, 0x59, 0x78, 0x06, 0xd8, 0x6c, 0xc0, 0x9d,
|
||||
0x52, 0x7e, 0x1e, 0x95, 0x63, 0xc1, 0x25, 0x6d, 0x7e, 0xd9, 0x28, 0x2a, 0x48, 0x7d, 0x7d, 0xa1,
|
||||
0x81, 0xe8, 0xf1, 0x2d, 0x05, 0x45, 0x9e, 0x2f, 0xff, 0xe5, 0xb9, 0x44, 0xde, 0x42, 0x41, 0x17,
|
||||
0x22, 0x3d, 0x98, 0x01, 0x8d, 0x82, 0xce, 0xfe, 0x80, 0x64, 0xa8, 0x54, 0x4d, 0xad, 0x5b, 0x4f,
|
||||
0xa6, 0x8d, 0xad, 0x63, 0x12, 0x93, 0x94, 0x84, 0xc9, 0xe0, 0x6d, 0x69, 0xfc, 0xa1, 0x86, 0x1b,
|
||||
0x0b, 0xea, 0xe7, 0x5d, 0xb8, 0x97, 0xc6, 0xbd, 0xb9, 0x9c, 0x36, 0x2a, 0xbf, 0xa7, 0x8d, 0x67,
|
||||
0x21, 0x53, 0x1f, 0x27, 0x3e, 0x0e, 0xc4, 0xc8, 0x8c, 0xce, 0x7c, 0x5a, 0x72, 0x78, 0xea, 0xaa,
|
||||
0x4f, 0x63, 0x2a, 0xf1, 0x11, 0x57, 0xd7, 0x17, 0x2d, 0x68, 0x58, 0x1e, 0x71, 0x55, 0xde, 0xa8,
|
||||
0x42, 0x1b, 0xf2, 0x46, 0x7d, 0x03, 0xf0, 0xd1, 0x02, 0xf1, 0x8e, 0x28, 0x16, 0xd3, 0xe2, 0xc0,
|
||||
0x97, 0xb7, 0xeb, 0x8e, 0xc7, 0xfa, 0x14, 0x3e, 0x59, 0xc2, 0x65, 0xce, 0xb9, 0xf3, 0xb9, 0x0a,
|
||||
0xab, 0x27, 0x32, 0x44, 0x31, 0x44, 0x25, 0x2b, 0xfa, 0x02, 0x97, 0xfd, 0x24, 0xb8, 0x74, 0x5f,
|
||||
0xec, 0x83, 0x35, 0xc0, 0xf3, 0xfa, 0x85, 0xba, 0xc5, 0xc5, 0x5a, 0x59, 0xb7, 0x00, 0x5e, 0x5d,
|
||||
0xb7, 0x64, 0x56, 0xe8, 0x2b, 0x80, 0xd6, 0x7f, 0x07, 0xd5, 0x5e, 0x95, 0xf1, 0x56, 0x88, 0xfd,
|
||||
0x7a, 0xed, 0x90, 0x39, 0x95, 0xee, 0xf1, 0xcd, 0x1f, 0x07, 0xfc, 0x4c, 0x1c, 0x70, 0x99, 0x38,
|
||||
0xe0, 0x2a, 0x71, 0xc0, 0x4d, 0xe2, 0x80, 0xef, 0x33, 0xa7, 0x72, 0x35, 0x73, 0x2a, 0xbf, 0x66,
|
||||
0x4e, 0xe5, 0xc3, 0xf3, 0xc2, 0xde, 0xea, 0x32, 0xad, 0x33, 0xe2, 0xcb, 0xf4, 0xe4, 0x9e, 0xe7,
|
||||
0x0f, 0x5c, 0xba, 0xbe, 0xfe, 0x66, 0xfa, 0xea, 0x1c, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xc5,
|
||||
0xd4, 0x72, 0x6a, 0xfd, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *MsgConvertCoinToERC20) VerboseEqual(that interface{}) error {
|
||||
@ -513,6 +619,120 @@ func (this *MsgConvertERC20ToCoinResponse) Equal(that interface{}) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (this *MsgConvertNativeCoinToERC20) VerboseEqual(that interface{}) error {
|
||||
if that == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that == nil && this != nil")
|
||||
}
|
||||
|
||||
that1, ok := that.(*MsgConvertNativeCoinToERC20)
|
||||
if !ok {
|
||||
that2, ok := that.(MsgConvertNativeCoinToERC20)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return fmt.Errorf("that is not of type *MsgConvertNativeCoinToERC20")
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that is type *MsgConvertNativeCoinToERC20 but is nil && this != nil")
|
||||
} else if this == nil {
|
||||
return fmt.Errorf("that is type *MsgConvertNativeCoinToERC20 but is not nil && this == nil")
|
||||
}
|
||||
if this.Initiator != that1.Initiator {
|
||||
return fmt.Errorf("Initiator this(%v) Not Equal that(%v)", this.Initiator, that1.Initiator)
|
||||
}
|
||||
if this.Receiver != that1.Receiver {
|
||||
return fmt.Errorf("Receiver this(%v) Not Equal that(%v)", this.Receiver, that1.Receiver)
|
||||
}
|
||||
if !this.Amount.Equal(that1.Amount) {
|
||||
return fmt.Errorf("Amount this(%v) Not Equal that(%v)", this.Amount, that1.Amount)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *MsgConvertNativeCoinToERC20) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*MsgConvertNativeCoinToERC20)
|
||||
if !ok {
|
||||
that2, ok := that.(MsgConvertNativeCoinToERC20)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if this.Initiator != that1.Initiator {
|
||||
return false
|
||||
}
|
||||
if this.Receiver != that1.Receiver {
|
||||
return false
|
||||
}
|
||||
if !this.Amount.Equal(that1.Amount) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (this *MsgConvertNativeCoinToERC20Response) VerboseEqual(that interface{}) error {
|
||||
if that == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that == nil && this != nil")
|
||||
}
|
||||
|
||||
that1, ok := that.(*MsgConvertNativeCoinToERC20Response)
|
||||
if !ok {
|
||||
that2, ok := that.(MsgConvertNativeCoinToERC20Response)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return fmt.Errorf("that is not of type *MsgConvertNativeCoinToERC20Response")
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that is type *MsgConvertNativeCoinToERC20Response but is nil && this != nil")
|
||||
} else if this == nil {
|
||||
return fmt.Errorf("that is type *MsgConvertNativeCoinToERC20Response but is not nil && this == nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *MsgConvertNativeCoinToERC20Response) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*MsgConvertNativeCoinToERC20Response)
|
||||
if !ok {
|
||||
that2, ok := that.(MsgConvertNativeCoinToERC20Response)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
@ -530,6 +750,8 @@ type MsgClient interface {
|
||||
ConvertCoinToERC20(ctx context.Context, in *MsgConvertCoinToERC20, opts ...grpc.CallOption) (*MsgConvertCoinToERC20Response, error)
|
||||
// ConvertERC20ToCoin defines a method for converting Kava ERC20 to sdk.Coin.
|
||||
ConvertERC20ToCoin(ctx context.Context, in *MsgConvertERC20ToCoin, opts ...grpc.CallOption) (*MsgConvertERC20ToCoinResponse, error)
|
||||
// ConvertNativeCoinToERC20 defines a method for converting a native sdk.Coin to an ERC20.
|
||||
ConvertNativeCoinToERC20(ctx context.Context, in *MsgConvertNativeCoinToERC20, opts ...grpc.CallOption) (*MsgConvertNativeCoinToERC20Response, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
@ -558,12 +780,23 @@ func (c *msgClient) ConvertERC20ToCoin(ctx context.Context, in *MsgConvertERC20T
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) ConvertNativeCoinToERC20(ctx context.Context, in *MsgConvertNativeCoinToERC20, opts ...grpc.CallOption) (*MsgConvertNativeCoinToERC20Response, error) {
|
||||
out := new(MsgConvertNativeCoinToERC20Response)
|
||||
err := c.cc.Invoke(ctx, "/kava.evmutil.v1beta1.Msg/ConvertNativeCoinToERC20", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
type MsgServer interface {
|
||||
// ConvertCoinToERC20 defines a method for converting sdk.Coin to Kava ERC20.
|
||||
ConvertCoinToERC20(context.Context, *MsgConvertCoinToERC20) (*MsgConvertCoinToERC20Response, error)
|
||||
// ConvertERC20ToCoin defines a method for converting Kava ERC20 to sdk.Coin.
|
||||
ConvertERC20ToCoin(context.Context, *MsgConvertERC20ToCoin) (*MsgConvertERC20ToCoinResponse, error)
|
||||
// ConvertNativeCoinToERC20 defines a method for converting a native sdk.Coin to an ERC20.
|
||||
ConvertNativeCoinToERC20(context.Context, *MsgConvertNativeCoinToERC20) (*MsgConvertNativeCoinToERC20Response, error)
|
||||
}
|
||||
|
||||
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
|
||||
@ -576,6 +809,9 @@ func (*UnimplementedMsgServer) ConvertCoinToERC20(ctx context.Context, req *MsgC
|
||||
func (*UnimplementedMsgServer) ConvertERC20ToCoin(ctx context.Context, req *MsgConvertERC20ToCoin) (*MsgConvertERC20ToCoinResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ConvertERC20ToCoin not implemented")
|
||||
}
|
||||
func (*UnimplementedMsgServer) ConvertNativeCoinToERC20(ctx context.Context, req *MsgConvertNativeCoinToERC20) (*MsgConvertNativeCoinToERC20Response, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ConvertNativeCoinToERC20 not implemented")
|
||||
}
|
||||
|
||||
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
|
||||
s.RegisterService(&_Msg_serviceDesc, srv)
|
||||
@ -617,6 +853,24 @@ func _Msg_ConvertERC20ToCoin_Handler(srv interface{}, ctx context.Context, dec f
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_ConvertNativeCoinToERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgConvertNativeCoinToERC20)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).ConvertNativeCoinToERC20(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/kava.evmutil.v1beta1.Msg/ConvertNativeCoinToERC20",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).ConvertNativeCoinToERC20(ctx, req.(*MsgConvertNativeCoinToERC20))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "kava.evmutil.v1beta1.Msg",
|
||||
HandlerType: (*MsgServer)(nil),
|
||||
@ -629,6 +883,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "ConvertERC20ToCoin",
|
||||
Handler: _Msg_ConvertERC20ToCoin_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ConvertNativeCoinToERC20",
|
||||
Handler: _Msg_ConvertNativeCoinToERC20_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "kava/evmutil/v1beta1/tx.proto",
|
||||
@ -783,6 +1041,78 @@ func (m *MsgConvertERC20ToCoinResponse) MarshalToSizedBuffer(dAtA []byte) (int,
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgConvertNativeCoinToERC20) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *MsgConvertNativeCoinToERC20) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgConvertNativeCoinToERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Amount != nil {
|
||||
{
|
||||
size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(m.Receiver) > 0 {
|
||||
i -= len(m.Receiver)
|
||||
copy(dAtA[i:], m.Receiver)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Receiver)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Initiator) > 0 {
|
||||
i -= len(m.Initiator)
|
||||
copy(dAtA[i:], m.Initiator)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Initiator)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgConvertNativeCoinToERC20Response) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *MsgConvertNativeCoinToERC20Response) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgConvertNativeCoinToERC20Response) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovTx(v)
|
||||
base := offset
|
||||
@ -856,6 +1186,36 @@ func (m *MsgConvertERC20ToCoinResponse) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgConvertNativeCoinToERC20) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Initiator)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.Receiver)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
if m.Amount != nil {
|
||||
l = m.Amount.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgConvertNativeCoinToERC20Response) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
return n
|
||||
}
|
||||
|
||||
func sovTx(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
@ -1292,6 +1652,206 @@ func (m *MsgConvertERC20ToCoinResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgConvertNativeCoinToERC20) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: MsgConvertNativeCoinToERC20: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgConvertNativeCoinToERC20: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Initiator", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Initiator = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Receiver = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Amount == nil {
|
||||
m.Amount = &types.Coin{}
|
||||
}
|
||||
if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTx(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgConvertNativeCoinToERC20Response) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: MsgConvertNativeCoinToERC20Response: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgConvertNativeCoinToERC20Response: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTx(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipTx(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
Loading…
Reference in New Issue
Block a user