mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-14 03:55:19 +00:00
feat(evmutil): add MsgConvertCosmosCoinFromERC20 proto (#1608)
* add MsgConvertCosmosCoinFromERC20 proto & Msg impl
* test MsgConvertCosmosCoinFromERC20 validation
* register msg codec in this PR 😅
This commit is contained in:
parent
d500cd1236
commit
d988330d7f
@ -267,6 +267,8 @@
|
|||||||
- [kava/evmutil/v1beta1/tx.proto](#kava/evmutil/v1beta1/tx.proto)
|
- [kava/evmutil/v1beta1/tx.proto](#kava/evmutil/v1beta1/tx.proto)
|
||||||
- [MsgConvertCoinToERC20](#kava.evmutil.v1beta1.MsgConvertCoinToERC20)
|
- [MsgConvertCoinToERC20](#kava.evmutil.v1beta1.MsgConvertCoinToERC20)
|
||||||
- [MsgConvertCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertCoinToERC20Response)
|
- [MsgConvertCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertCoinToERC20Response)
|
||||||
|
- [MsgConvertCosmosCoinFromERC20](#kava.evmutil.v1beta1.MsgConvertCosmosCoinFromERC20)
|
||||||
|
- [MsgConvertCosmosCoinFromERC20Response](#kava.evmutil.v1beta1.MsgConvertCosmosCoinFromERC20Response)
|
||||||
- [MsgConvertCosmosCoinToERC20](#kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20)
|
- [MsgConvertCosmosCoinToERC20](#kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20)
|
||||||
- [MsgConvertCosmosCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20Response)
|
- [MsgConvertCosmosCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20Response)
|
||||||
- [MsgConvertERC20ToCoin](#kava.evmutil.v1beta1.MsgConvertERC20ToCoin)
|
- [MsgConvertERC20ToCoin](#kava.evmutil.v1beta1.MsgConvertERC20ToCoin)
|
||||||
@ -3885,7 +3887,7 @@ Query defines the gRPC querier service for evmutil module
|
|||||||
<a name="kava.evmutil.v1beta1.MsgConvertCoinToERC20"></a>
|
<a name="kava.evmutil.v1beta1.MsgConvertCoinToERC20"></a>
|
||||||
|
|
||||||
### MsgConvertCoinToERC20
|
### MsgConvertCoinToERC20
|
||||||
MsgConvertCoinToERC20 defines a conversion from sdk.Coin to Kava ERC20.
|
MsgConvertCoinToERC20 defines a conversion from sdk.Coin to Kava ERC20 for EVM-native assets.
|
||||||
|
|
||||||
|
|
||||||
| Field | Type | Label | Description |
|
| Field | Type | Label | Description |
|
||||||
@ -3909,10 +3911,37 @@ MsgConvertCoinToERC20Response defines the response value from Msg/ConvertCoinToE
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="kava.evmutil.v1beta1.MsgConvertCosmosCoinFromERC20"></a>
|
||||||
|
|
||||||
|
### MsgConvertCosmosCoinFromERC20
|
||||||
|
ConvertCosmosCoinFromERC20 defines a conversion from ERC20 to cosmos coins for cosmos-native assets.
|
||||||
|
|
||||||
|
|
||||||
|
| Field | Type | Label | Description |
|
||||||
|
| ----- | ---- | ----- | ----------- |
|
||||||
|
| `initiator` | [string](#string) | | EVM hex address initiating the conversion. |
|
||||||
|
| `receiver` | [string](#string) | | Kava bech32 address that will receive the cosmos coins. |
|
||||||
|
| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Amount is the amount to convert, expressed as a Cosmos coin. |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="kava.evmutil.v1beta1.MsgConvertCosmosCoinFromERC20Response"></a>
|
||||||
|
|
||||||
|
### MsgConvertCosmosCoinFromERC20Response
|
||||||
|
MsgConvertCosmosCoinFromERC20Response defines the response value from Msg/MsgConvertCosmosCoinFromERC20.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20"></a>
|
<a name="kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20"></a>
|
||||||
|
|
||||||
### MsgConvertCosmosCoinToERC20
|
### MsgConvertCosmosCoinToERC20
|
||||||
ConvertCosmosCoinToERC20 defines a conversion from cosmos sdk.Coin to ERC20.
|
ConvertCosmosCoinToERC20 defines a conversion from cosmos sdk.Coin to ERC20 for cosmos-native assets.
|
||||||
|
|
||||||
|
|
||||||
| Field | Type | Label | Description |
|
| Field | Type | Label | Description |
|
||||||
@ -3939,7 +3968,7 @@ MsgConvertCosmosCoinToERC20Response defines the response value from Msg/MsgConve
|
|||||||
<a name="kava.evmutil.v1beta1.MsgConvertERC20ToCoin"></a>
|
<a name="kava.evmutil.v1beta1.MsgConvertERC20ToCoin"></a>
|
||||||
|
|
||||||
### MsgConvertERC20ToCoin
|
### MsgConvertERC20ToCoin
|
||||||
MsgConvertERC20ToCoin defines a conversion from Kava ERC20 to sdk.Coin.
|
MsgConvertERC20ToCoin defines a conversion from Kava ERC20 to sdk.Coin for EVM-native assets.
|
||||||
|
|
||||||
|
|
||||||
| Field | Type | Label | Description |
|
| Field | Type | Label | Description |
|
||||||
@ -3981,6 +4010,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. | |
|
| `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. | |
|
| `ConvertERC20ToCoin` | [MsgConvertERC20ToCoin](#kava.evmutil.v1beta1.MsgConvertERC20ToCoin) | [MsgConvertERC20ToCoinResponse](#kava.evmutil.v1beta1.MsgConvertERC20ToCoinResponse) | ConvertERC20ToCoin defines a method for converting Kava ERC20 to sdk.Coin. | |
|
||||||
| `ConvertCosmosCoinToERC20` | [MsgConvertCosmosCoinToERC20](#kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20) | [MsgConvertCosmosCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20Response) | ConvertCosmosCoinToERC20 defines a method for converting a cosmos sdk.Coin to an ERC20. | |
|
| `ConvertCosmosCoinToERC20` | [MsgConvertCosmosCoinToERC20](#kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20) | [MsgConvertCosmosCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20Response) | ConvertCosmosCoinToERC20 defines a method for converting a cosmos sdk.Coin to an ERC20. | |
|
||||||
|
| `ConvertCosmosCoinFromERC20` | [MsgConvertCosmosCoinFromERC20](#kava.evmutil.v1beta1.MsgConvertCosmosCoinFromERC20) | [MsgConvertCosmosCoinFromERC20Response](#kava.evmutil.v1beta1.MsgConvertCosmosCoinFromERC20Response) | ConvertCosmosCoinFromERC20 defines a method for converting a cosmos sdk.Coin to an ERC20. | |
|
||||||
|
|
||||||
<!-- end services -->
|
<!-- end services -->
|
||||||
|
|
||||||
|
@ -19,9 +19,12 @@ service Msg {
|
|||||||
|
|
||||||
// ConvertCosmosCoinToERC20 defines a method for converting a cosmos sdk.Coin to an ERC20.
|
// ConvertCosmosCoinToERC20 defines a method for converting a cosmos sdk.Coin to an ERC20.
|
||||||
rpc ConvertCosmosCoinToERC20(MsgConvertCosmosCoinToERC20) returns (MsgConvertCosmosCoinToERC20Response);
|
rpc ConvertCosmosCoinToERC20(MsgConvertCosmosCoinToERC20) returns (MsgConvertCosmosCoinToERC20Response);
|
||||||
|
|
||||||
|
// ConvertCosmosCoinFromERC20 defines a method for converting a cosmos sdk.Coin to an ERC20.
|
||||||
|
rpc ConvertCosmosCoinFromERC20(MsgConvertCosmosCoinFromERC20) returns (MsgConvertCosmosCoinFromERC20Response);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgConvertCoinToERC20 defines a conversion from sdk.Coin to Kava ERC20.
|
// MsgConvertCoinToERC20 defines a conversion from sdk.Coin to Kava ERC20 for EVM-native assets.
|
||||||
message MsgConvertCoinToERC20 {
|
message MsgConvertCoinToERC20 {
|
||||||
// Kava bech32 address initiating the conversion.
|
// Kava bech32 address initiating the conversion.
|
||||||
string initiator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
string initiator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||||
@ -34,7 +37,7 @@ message MsgConvertCoinToERC20 {
|
|||||||
// MsgConvertCoinToERC20Response defines the response value from Msg/ConvertCoinToERC20.
|
// MsgConvertCoinToERC20Response defines the response value from Msg/ConvertCoinToERC20.
|
||||||
message MsgConvertCoinToERC20Response {}
|
message MsgConvertCoinToERC20Response {}
|
||||||
|
|
||||||
// MsgConvertERC20ToCoin defines a conversion from Kava ERC20 to sdk.Coin.
|
// MsgConvertERC20ToCoin defines a conversion from Kava ERC20 to sdk.Coin for EVM-native assets.
|
||||||
message MsgConvertERC20ToCoin {
|
message MsgConvertERC20ToCoin {
|
||||||
// EVM 0x hex address initiating the conversion.
|
// EVM 0x hex address initiating the conversion.
|
||||||
string initiator = 1;
|
string initiator = 1;
|
||||||
@ -54,7 +57,7 @@ message MsgConvertERC20ToCoin {
|
|||||||
// Msg/MsgConvertERC20ToCoin.
|
// Msg/MsgConvertERC20ToCoin.
|
||||||
message MsgConvertERC20ToCoinResponse {}
|
message MsgConvertERC20ToCoinResponse {}
|
||||||
|
|
||||||
// ConvertCosmosCoinToERC20 defines a conversion from cosmos sdk.Coin to ERC20.
|
// ConvertCosmosCoinToERC20 defines a conversion from cosmos sdk.Coin to ERC20 for cosmos-native assets.
|
||||||
message MsgConvertCosmosCoinToERC20 {
|
message MsgConvertCosmosCoinToERC20 {
|
||||||
// Kava bech32 address initiating the conversion.
|
// Kava bech32 address initiating the conversion.
|
||||||
string initiator = 1;
|
string initiator = 1;
|
||||||
@ -66,3 +69,16 @@ message MsgConvertCosmosCoinToERC20 {
|
|||||||
|
|
||||||
// MsgConvertCosmosCoinToERC20Response defines the response value from Msg/MsgConvertCosmosCoinToERC20.
|
// MsgConvertCosmosCoinToERC20Response defines the response value from Msg/MsgConvertCosmosCoinToERC20.
|
||||||
message MsgConvertCosmosCoinToERC20Response {}
|
message MsgConvertCosmosCoinToERC20Response {}
|
||||||
|
|
||||||
|
// ConvertCosmosCoinFromERC20 defines a conversion from ERC20 to cosmos coins for cosmos-native assets.
|
||||||
|
message MsgConvertCosmosCoinFromERC20 {
|
||||||
|
// EVM hex address initiating the conversion.
|
||||||
|
string initiator = 1;
|
||||||
|
// Kava bech32 address that will receive the cosmos coins.
|
||||||
|
string receiver = 2;
|
||||||
|
// Amount is the amount to convert, expressed as a Cosmos coin.
|
||||||
|
cosmos.base.v1beta1.Coin amount = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// MsgConvertCosmosCoinFromERC20Response defines the response value from Msg/MsgConvertCosmosCoinFromERC20.
|
||||||
|
message MsgConvertCosmosCoinFromERC20Response {}
|
||||||
|
@ -149,3 +149,12 @@ func (s msgServer) ConvertCosmosCoinToERC20(
|
|||||||
|
|
||||||
return &types.MsgConvertCosmosCoinToERC20Response{}, nil
|
return &types.MsgConvertCosmosCoinToERC20Response{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ConvertCosmosCoinFromERC20 converts an ERC20 representation of a cosmos-native asset
|
||||||
|
// back into an sdk.Coin.
|
||||||
|
func (s msgServer) ConvertCosmosCoinFromERC20(
|
||||||
|
goCtx context.Context,
|
||||||
|
req *types.MsgConvertCosmosCoinFromERC20,
|
||||||
|
) (*types.MsgConvertCosmosCoinFromERC20Response, error) {
|
||||||
|
panic("unimplemented - coming soon!")
|
||||||
|
}
|
||||||
|
@ -16,6 +16,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
|||||||
legacy.RegisterAminoMsg(cdc, &MsgConvertCoinToERC20{}, "evmutil/MsgConvertCoinToERC20")
|
legacy.RegisterAminoMsg(cdc, &MsgConvertCoinToERC20{}, "evmutil/MsgConvertCoinToERC20")
|
||||||
legacy.RegisterAminoMsg(cdc, &MsgConvertERC20ToCoin{}, "evmutil/MsgConvertERC20ToCoin")
|
legacy.RegisterAminoMsg(cdc, &MsgConvertERC20ToCoin{}, "evmutil/MsgConvertERC20ToCoin")
|
||||||
legacy.RegisterAminoMsg(cdc, &MsgConvertCosmosCoinToERC20{}, "evmutil/MsgConvertCosmosCoinToERC20")
|
legacy.RegisterAminoMsg(cdc, &MsgConvertCosmosCoinToERC20{}, "evmutil/MsgConvertCosmosCoinToERC20")
|
||||||
|
legacy.RegisterAminoMsg(cdc, &MsgConvertCosmosCoinFromERC20{}, "evmutil/MsgConvertCosmosCoinFromERC20")
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
|
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
|
||||||
@ -23,6 +24,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
|
|||||||
&MsgConvertCoinToERC20{},
|
&MsgConvertCoinToERC20{},
|
||||||
&MsgConvertERC20ToCoin{},
|
&MsgConvertERC20ToCoin{},
|
||||||
&MsgConvertCosmosCoinToERC20{},
|
&MsgConvertCosmosCoinToERC20{},
|
||||||
|
&MsgConvertCosmosCoinFromERC20{},
|
||||||
)
|
)
|
||||||
|
|
||||||
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
|
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
|
||||||
|
@ -18,6 +18,8 @@ var (
|
|||||||
|
|
||||||
_ sdk.Msg = &MsgConvertCosmosCoinToERC20{}
|
_ sdk.Msg = &MsgConvertCosmosCoinToERC20{}
|
||||||
_ legacytx.LegacyMsg = &MsgConvertCosmosCoinToERC20{}
|
_ legacytx.LegacyMsg = &MsgConvertCosmosCoinToERC20{}
|
||||||
|
_ sdk.Msg = &MsgConvertCosmosCoinFromERC20{}
|
||||||
|
_ legacytx.LegacyMsg = &MsgConvertCosmosCoinFromERC20{}
|
||||||
)
|
)
|
||||||
|
|
||||||
// legacy message types
|
// legacy message types
|
||||||
@ -25,7 +27,8 @@ const (
|
|||||||
TypeMsgConvertCoinToERC20 = "evmutil_convert_coin_to_erc20"
|
TypeMsgConvertCoinToERC20 = "evmutil_convert_coin_to_erc20"
|
||||||
TypeMsgConvertERC20ToCoin = "evmutil_convert_erc20_to_coin"
|
TypeMsgConvertERC20ToCoin = "evmutil_convert_erc20_to_coin"
|
||||||
|
|
||||||
TypeMsgConvertCosmosCoinToERC20 = "evmutil_convert_cosmos_coin_to_erc20"
|
TypeMsgConvertCosmosCoinToERC20 = "evmutil_convert_cosmos_coin_to_erc20"
|
||||||
|
TypeMsgConvertCosmosCoinFromERC20 = "evmutil_convert_cosmos_coin_from_erc20"
|
||||||
)
|
)
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
@ -210,3 +213,54 @@ func (MsgConvertCosmosCoinToERC20) Route() string { return RouterKey }
|
|||||||
|
|
||||||
// Type implements legacytx.LegacyMsg
|
// Type implements legacytx.LegacyMsg
|
||||||
func (MsgConvertCosmosCoinToERC20) Type() string { return TypeMsgConvertCosmosCoinToERC20 }
|
func (MsgConvertCosmosCoinToERC20) Type() string { return TypeMsgConvertCosmosCoinToERC20 }
|
||||||
|
|
||||||
|
// NewMsgConvertCosmosCoinToERC20 returns a new MsgConvertCosmosCoinToERC20
|
||||||
|
func NewMsgConvertCosmosCoinFromERC20(
|
||||||
|
initiator string,
|
||||||
|
receiver string,
|
||||||
|
amount sdk.Coin,
|
||||||
|
) MsgConvertCosmosCoinFromERC20 {
|
||||||
|
return MsgConvertCosmosCoinFromERC20{
|
||||||
|
Initiator: initiator,
|
||||||
|
Receiver: receiver,
|
||||||
|
Amount: &amount,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSigners implements types.Msg
|
||||||
|
func (msg MsgConvertCosmosCoinFromERC20) GetSigners() []sdk.AccAddress {
|
||||||
|
sender0x, err := NewInternalEVMAddressFromString(msg.Initiator)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return []sdk.AccAddress{sender0x.Bytes()}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateBasic implements types.Msg
|
||||||
|
func (msg MsgConvertCosmosCoinFromERC20) ValidateBasic() error {
|
||||||
|
if !common.IsHexAddress(msg.Initiator) {
|
||||||
|
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "initiator is not a valid hex address (%s)", msg.Initiator)
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := sdk.AccAddressFromBech32(msg.Receiver)
|
||||||
|
if err != nil {
|
||||||
|
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid receiver address (%s): %s", msg.Receiver, err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
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 MsgConvertCosmosCoinFromERC20) GetSignBytes() []byte {
|
||||||
|
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Route implements legacytx.LegacyMsg
|
||||||
|
func (MsgConvertCosmosCoinFromERC20) Route() string { return RouterKey }
|
||||||
|
|
||||||
|
// Type implements legacytx.LegacyMsg
|
||||||
|
func (MsgConvertCosmosCoinFromERC20) Type() string { return TypeMsgConvertCosmosCoinFromERC20 }
|
||||||
|
@ -310,3 +310,115 @@ func TestConvertCosmosCoinToERC20_GetSigners(t *testing.T) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestConvertCosmosCoinFromERC20_ValidateBasic(t *testing.T) {
|
||||||
|
validHexAddr := testutil.RandomEvmAddress()
|
||||||
|
validKavaAddr := app.RandomAddress()
|
||||||
|
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: validHexAddr.String(),
|
||||||
|
receiver: validKavaAddr.String(),
|
||||||
|
amount: validAmount,
|
||||||
|
expectedErr: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "invalid - sending to 0x addr",
|
||||||
|
initiator: validHexAddr.String(),
|
||||||
|
receiver: testutil.RandomEvmAddress().Hex(),
|
||||||
|
amount: validAmount,
|
||||||
|
expectedErr: "invalid receiver address",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "invalid - invalid initiator",
|
||||||
|
initiator: invalidAddr,
|
||||||
|
receiver: app.RandomAddress().String(),
|
||||||
|
amount: validAmount,
|
||||||
|
expectedErr: "initiator is not a valid hex address",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "invalid - invalid receiver",
|
||||||
|
initiator: validHexAddr.String(),
|
||||||
|
receiver: invalidAddr,
|
||||||
|
amount: validAmount,
|
||||||
|
expectedErr: "invalid receiver address",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "invalid - invalid amount - nil",
|
||||||
|
initiator: validHexAddr.String(),
|
||||||
|
receiver: validKavaAddr.String(),
|
||||||
|
amount: sdk.Coin{},
|
||||||
|
expectedErr: "invalid coins",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "invalid - invalid amount - zero",
|
||||||
|
initiator: validHexAddr.String(),
|
||||||
|
receiver: validKavaAddr.String(),
|
||||||
|
amount: sdk.NewInt64Coin("magic", 0),
|
||||||
|
expectedErr: "invalid coins",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "invalid - invalid amount - negative",
|
||||||
|
initiator: validHexAddr.String(),
|
||||||
|
receiver: validKavaAddr.String(),
|
||||||
|
amount: sdk.Coin{Denom: "magic", Amount: sdkmath.NewInt(-42)},
|
||||||
|
expectedErr: "invalid coins",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "invalid - invalid amount - invalid denom",
|
||||||
|
initiator: validHexAddr.String(),
|
||||||
|
receiver: validKavaAddr.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.NewMsgConvertCosmosCoinFromERC20(
|
||||||
|
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_cosmos_coin_from_erc20", msg.Type())
|
||||||
|
require.NotPanics(t, func() { _ = msg.GetSignBytes() })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestConvertCosmosCoinFromERC20_GetSigners(t *testing.T) {
|
||||||
|
t.Run("valid", func(t *testing.T) {
|
||||||
|
initiator0x := testutil.RandomEvmAddress()
|
||||||
|
initiator := sdk.AccAddress(initiator0x.Bytes())
|
||||||
|
signers := types.MsgConvertCosmosCoinFromERC20{
|
||||||
|
Initiator: initiator0x.Hex(),
|
||||||
|
}.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.MsgConvertCosmosCoinFromERC20{
|
||||||
|
Initiator: "not-an-address",
|
||||||
|
}.GetSigners()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -31,7 +31,7 @@ var _ = math.Inf
|
|||||||
// proto package needs to be updated.
|
// proto package needs to be updated.
|
||||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
// MsgConvertCoinToERC20 defines a conversion from sdk.Coin to Kava ERC20.
|
// MsgConvertCoinToERC20 defines a conversion from sdk.Coin to Kava ERC20 for EVM-native assets.
|
||||||
type MsgConvertCoinToERC20 struct {
|
type MsgConvertCoinToERC20 struct {
|
||||||
// Kava bech32 address initiating the conversion.
|
// Kava bech32 address initiating the conversion.
|
||||||
Initiator string `protobuf:"bytes,1,opt,name=initiator,proto3" json:"initiator,omitempty"`
|
Initiator string `protobuf:"bytes,1,opt,name=initiator,proto3" json:"initiator,omitempty"`
|
||||||
@ -132,7 +132,7 @@ func (m *MsgConvertCoinToERC20Response) XXX_DiscardUnknown() {
|
|||||||
|
|
||||||
var xxx_messageInfo_MsgConvertCoinToERC20Response proto.InternalMessageInfo
|
var xxx_messageInfo_MsgConvertCoinToERC20Response proto.InternalMessageInfo
|
||||||
|
|
||||||
// MsgConvertERC20ToCoin defines a conversion from Kava ERC20 to sdk.Coin.
|
// MsgConvertERC20ToCoin defines a conversion from Kava ERC20 to sdk.Coin for EVM-native assets.
|
||||||
type MsgConvertERC20ToCoin struct {
|
type MsgConvertERC20ToCoin struct {
|
||||||
// EVM 0x hex address initiating the conversion.
|
// EVM 0x hex address initiating the conversion.
|
||||||
Initiator string `protobuf:"bytes,1,opt,name=initiator,proto3" json:"initiator,omitempty"`
|
Initiator string `protobuf:"bytes,1,opt,name=initiator,proto3" json:"initiator,omitempty"`
|
||||||
@ -236,7 +236,7 @@ func (m *MsgConvertERC20ToCoinResponse) XXX_DiscardUnknown() {
|
|||||||
|
|
||||||
var xxx_messageInfo_MsgConvertERC20ToCoinResponse proto.InternalMessageInfo
|
var xxx_messageInfo_MsgConvertERC20ToCoinResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
// ConvertCosmosCoinToERC20 defines a conversion from cosmos sdk.Coin to ERC20.
|
// ConvertCosmosCoinToERC20 defines a conversion from cosmos sdk.Coin to ERC20 for cosmos-native assets.
|
||||||
type MsgConvertCosmosCoinToERC20 struct {
|
type MsgConvertCosmosCoinToERC20 struct {
|
||||||
// Kava bech32 address initiating the conversion.
|
// Kava bech32 address initiating the conversion.
|
||||||
Initiator string `protobuf:"bytes,1,opt,name=initiator,proto3" json:"initiator,omitempty"`
|
Initiator string `protobuf:"bytes,1,opt,name=initiator,proto3" json:"initiator,omitempty"`
|
||||||
@ -337,6 +337,107 @@ func (m *MsgConvertCosmosCoinToERC20Response) XXX_DiscardUnknown() {
|
|||||||
|
|
||||||
var xxx_messageInfo_MsgConvertCosmosCoinToERC20Response proto.InternalMessageInfo
|
var xxx_messageInfo_MsgConvertCosmosCoinToERC20Response proto.InternalMessageInfo
|
||||||
|
|
||||||
|
// ConvertCosmosCoinFromERC20 defines a conversion from ERC20 to cosmos coins for cosmos-native assets.
|
||||||
|
type MsgConvertCosmosCoinFromERC20 struct {
|
||||||
|
// EVM hex address initiating the conversion.
|
||||||
|
Initiator string `protobuf:"bytes,1,opt,name=initiator,proto3" json:"initiator,omitempty"`
|
||||||
|
// Kava bech32 address that will receive the cosmos coins.
|
||||||
|
Receiver string `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"`
|
||||||
|
// Amount is the amount to convert, expressed as a Cosmos coin.
|
||||||
|
Amount *types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20) Reset() { *m = MsgConvertCosmosCoinFromERC20{} }
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*MsgConvertCosmosCoinFromERC20) ProtoMessage() {}
|
||||||
|
func (*MsgConvertCosmosCoinFromERC20) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_6e82783c6c58f89c, []int{6}
|
||||||
|
}
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_MsgConvertCosmosCoinFromERC20.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 *MsgConvertCosmosCoinFromERC20) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_MsgConvertCosmosCoinFromERC20.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_MsgConvertCosmosCoinFromERC20.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_MsgConvertCosmosCoinFromERC20 proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20) GetInitiator() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Initiator
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20) GetReceiver() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Receiver
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20) GetAmount() *types.Coin {
|
||||||
|
if m != nil {
|
||||||
|
return m.Amount
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MsgConvertCosmosCoinFromERC20Response defines the response value from Msg/MsgConvertCosmosCoinFromERC20.
|
||||||
|
type MsgConvertCosmosCoinFromERC20Response struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20Response) Reset() { *m = MsgConvertCosmosCoinFromERC20Response{} }
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20Response) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*MsgConvertCosmosCoinFromERC20Response) ProtoMessage() {}
|
||||||
|
func (*MsgConvertCosmosCoinFromERC20Response) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_6e82783c6c58f89c, []int{7}
|
||||||
|
}
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20Response) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_MsgConvertCosmosCoinFromERC20Response.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 *MsgConvertCosmosCoinFromERC20Response) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_MsgConvertCosmosCoinFromERC20Response.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20Response) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20Response) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_MsgConvertCosmosCoinFromERC20Response.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_MsgConvertCosmosCoinFromERC20Response proto.InternalMessageInfo
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterType((*MsgConvertCoinToERC20)(nil), "kava.evmutil.v1beta1.MsgConvertCoinToERC20")
|
proto.RegisterType((*MsgConvertCoinToERC20)(nil), "kava.evmutil.v1beta1.MsgConvertCoinToERC20")
|
||||||
proto.RegisterType((*MsgConvertCoinToERC20Response)(nil), "kava.evmutil.v1beta1.MsgConvertCoinToERC20Response")
|
proto.RegisterType((*MsgConvertCoinToERC20Response)(nil), "kava.evmutil.v1beta1.MsgConvertCoinToERC20Response")
|
||||||
@ -344,45 +445,49 @@ func init() {
|
|||||||
proto.RegisterType((*MsgConvertERC20ToCoinResponse)(nil), "kava.evmutil.v1beta1.MsgConvertERC20ToCoinResponse")
|
proto.RegisterType((*MsgConvertERC20ToCoinResponse)(nil), "kava.evmutil.v1beta1.MsgConvertERC20ToCoinResponse")
|
||||||
proto.RegisterType((*MsgConvertCosmosCoinToERC20)(nil), "kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20")
|
proto.RegisterType((*MsgConvertCosmosCoinToERC20)(nil), "kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20")
|
||||||
proto.RegisterType((*MsgConvertCosmosCoinToERC20Response)(nil), "kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20Response")
|
proto.RegisterType((*MsgConvertCosmosCoinToERC20Response)(nil), "kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20Response")
|
||||||
|
proto.RegisterType((*MsgConvertCosmosCoinFromERC20)(nil), "kava.evmutil.v1beta1.MsgConvertCosmosCoinFromERC20")
|
||||||
|
proto.RegisterType((*MsgConvertCosmosCoinFromERC20Response)(nil), "kava.evmutil.v1beta1.MsgConvertCosmosCoinFromERC20Response")
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("kava/evmutil/v1beta1/tx.proto", fileDescriptor_6e82783c6c58f89c) }
|
func init() { proto.RegisterFile("kava/evmutil/v1beta1/tx.proto", fileDescriptor_6e82783c6c58f89c) }
|
||||||
|
|
||||||
var fileDescriptor_6e82783c6c58f89c = []byte{
|
var fileDescriptor_6e82783c6c58f89c = []byte{
|
||||||
// 517 bytes of a gzipped FileDescriptorProto
|
// 559 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x41, 0x6b, 0x13, 0x41,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x41, 0x6b, 0xd4, 0x4c,
|
||||||
0x14, 0xce, 0xb4, 0x52, 0xcc, 0x78, 0x29, 0x43, 0x84, 0xed, 0x6a, 0x37, 0x25, 0xa2, 0x54, 0x24,
|
0x18, 0xde, 0x69, 0x4b, 0xf9, 0x76, 0xbe, 0x4b, 0x19, 0x56, 0x48, 0xa3, 0xcd, 0x96, 0x95, 0x6a,
|
||||||
0xb3, 0x4d, 0x2a, 0x82, 0xe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 0x5c, 0x78, 0x3f, 0xa1, 0x11, 0x65, 0x29, 0x4d, 0x9c, 0x35, 0x1d,
|
0x08, 0x63, 0xcf, 0x79, 0xe4, 0x87, 0x9e, 0x7d, 0x09, 0x45, 0x3a, 0xfc, 0x2f, 0x22, 0x2e, 0xf1,
|
||||||
0x16, 0x94, 0x77, 0xd4, 0x81, 0x1b, 0x64, 0x2c, 0xa6, 0x5c, 0x39, 0xeb, 0x3b, 0x60, 0xf7, 0x41,
|
0x63, 0x12, 0x69, 0x4b, 0x82, 0x66, 0x17, 0x6b, 0xd4, 0x81, 0xab, 0x38, 0xa0, 0xd3, 0x90, 0x6b,
|
||||||
0x77, 0x0b, 0x9b, 0x6c, 0x5a, 0xcf, 0x42, 0x24, 0xd6, 0x2c, 0x02, 0x03, 0x6c, 0x35, 0xe1, 0x76,
|
0xcb, 0x9b, 0x60, 0xfb, 0xff, 0xee, 0xba, 0x29, 0xb3, 0x09, 0x3f, 0xb9, 0x49, 0x53, 0xa8, 0xb0,
|
||||||
0x25, 0xbf, 0x80, 0xca, 0x89, 0xe0, 0x92, 0xb6, 0x3e, 0xaf, 0xd9, 0x0a, 0x72, 0xdf, 0x40, 0x68,
|
0x25, 0xb0, 0xd5, 0x84, 0x1b, 0xa5, 0xfa, 0x6c, 0xc2, 0x26, 0x34, 0x64, 0xa4, 0xf5, 0x7a, 0x49,
|
||||||
0x20, 0x7a, 0xfc, 0x97, 0x02, 0x9b, 0xe7, 0xcb, 0xdb, 0x3c, 0x97, 0xc8, 0xbb, 0x51, 0xd0, 0x83,
|
0x75, 0x90, 0xc6, 0x86, 0x54, 0x00, 0xd1, 0xad, 0x9f, 0x1c, 0xa8, 0x3a, 0x1f, 0x5c, 0xd5, 0x59,
|
||||||
0x48, 0x0f, 0x66, 0x48, 0x93, 0xa8, 0xbb, 0x37, 0x24, 0x05, 0x2a, 0x57, 0x53, 0xef, 0x35, 0xb2,
|
0x61, 0xef, 0xd2, 0x41, 0x1f, 0x22, 0x31, 0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0x94, 0x42, 0xca, 0x7b, 0x00, 0xf5, 0x8a, 0x73,
|
||||||
0x3f, 0xb7, 0xf6, 0x56, 0x97, 0x69, 0x9f, 0x92, 0x50, 0xe6, 0x27, 0xff, 0xac, 0x7c, 0xe0, 0xf2,
|
0xd3, 0xfb, 0xfd, 0xcc, 0x05, 0x49, 0x7f, 0xfc, 0x07, 0xa4, 0x5c, 0x50, 0x7f, 0xff, 0xe2, 0x9b,
|
||||||
0xf5, 0x0d, 0x37, 0xf2, 0x57, 0x67, 0xff, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x66, 0xcd,
|
0x01, 0x3e, 0x27, 0x06, 0x38, 0x4d, 0x0c, 0x70, 0x96, 0x18, 0xe0, 0x22, 0x31, 0xc0, 0x87, 0xb9,
|
||||||
0xe3, 0xfd, 0x04, 0x00, 0x00,
|
0x51, 0x3b, 0x9b, 0x1b, 0xb5, 0x2f, 0x73, 0xa3, 0xf6, 0xe2, 0x9e, 0xf2, 0x00, 0x88, 0x42, 0xed,
|
||||||
|
0x23, 0xec, 0xb0, 0xf4, 0xcb, 0x3a, 0x2e, 0xfe, 0x29, 0xd2, 0x77, 0xc0, 0x59, 0x4d, 0x9f, 0xef,
|
||||||
|
0xde, 0xf7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa2, 0x5a, 0x1f, 0x90, 0x46, 0x06, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *MsgConvertCoinToERC20) VerboseEqual(that interface{}) error {
|
func (this *MsgConvertCoinToERC20) VerboseEqual(that interface{}) error {
|
||||||
@ -733,6 +838,120 @@ func (this *MsgConvertCosmosCoinToERC20Response) Equal(that interface{}) bool {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
func (this *MsgConvertCosmosCoinFromERC20) VerboseEqual(that interface{}) error {
|
||||||
|
if that == nil {
|
||||||
|
if this == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return fmt.Errorf("that == nil && this != nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
that1, ok := that.(*MsgConvertCosmosCoinFromERC20)
|
||||||
|
if !ok {
|
||||||
|
that2, ok := that.(MsgConvertCosmosCoinFromERC20)
|
||||||
|
if ok {
|
||||||
|
that1 = &that2
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("that is not of type *MsgConvertCosmosCoinFromERC20")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if that1 == nil {
|
||||||
|
if this == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return fmt.Errorf("that is type *MsgConvertCosmosCoinFromERC20 but is nil && this != nil")
|
||||||
|
} else if this == nil {
|
||||||
|
return fmt.Errorf("that is type *MsgConvertCosmosCoinFromERC20 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 *MsgConvertCosmosCoinFromERC20) Equal(that interface{}) bool {
|
||||||
|
if that == nil {
|
||||||
|
return this == nil
|
||||||
|
}
|
||||||
|
|
||||||
|
that1, ok := that.(*MsgConvertCosmosCoinFromERC20)
|
||||||
|
if !ok {
|
||||||
|
that2, ok := that.(MsgConvertCosmosCoinFromERC20)
|
||||||
|
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 *MsgConvertCosmosCoinFromERC20Response) VerboseEqual(that interface{}) error {
|
||||||
|
if that == nil {
|
||||||
|
if this == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return fmt.Errorf("that == nil && this != nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
that1, ok := that.(*MsgConvertCosmosCoinFromERC20Response)
|
||||||
|
if !ok {
|
||||||
|
that2, ok := that.(MsgConvertCosmosCoinFromERC20Response)
|
||||||
|
if ok {
|
||||||
|
that1 = &that2
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("that is not of type *MsgConvertCosmosCoinFromERC20Response")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if that1 == nil {
|
||||||
|
if this == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return fmt.Errorf("that is type *MsgConvertCosmosCoinFromERC20Response but is nil && this != nil")
|
||||||
|
} else if this == nil {
|
||||||
|
return fmt.Errorf("that is type *MsgConvertCosmosCoinFromERC20Response but is not nil && this == nil")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *MsgConvertCosmosCoinFromERC20Response) Equal(that interface{}) bool {
|
||||||
|
if that == nil {
|
||||||
|
return this == nil
|
||||||
|
}
|
||||||
|
|
||||||
|
that1, ok := that.(*MsgConvertCosmosCoinFromERC20Response)
|
||||||
|
if !ok {
|
||||||
|
that2, ok := that.(MsgConvertCosmosCoinFromERC20Response)
|
||||||
|
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.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
var _ context.Context
|
var _ context.Context
|
||||||
@ -752,6 +971,8 @@ type MsgClient interface {
|
|||||||
ConvertERC20ToCoin(ctx context.Context, in *MsgConvertERC20ToCoin, opts ...grpc.CallOption) (*MsgConvertERC20ToCoinResponse, error)
|
ConvertERC20ToCoin(ctx context.Context, in *MsgConvertERC20ToCoin, opts ...grpc.CallOption) (*MsgConvertERC20ToCoinResponse, error)
|
||||||
// ConvertCosmosCoinToERC20 defines a method for converting a cosmos sdk.Coin to an ERC20.
|
// ConvertCosmosCoinToERC20 defines a method for converting a cosmos sdk.Coin to an ERC20.
|
||||||
ConvertCosmosCoinToERC20(ctx context.Context, in *MsgConvertCosmosCoinToERC20, opts ...grpc.CallOption) (*MsgConvertCosmosCoinToERC20Response, error)
|
ConvertCosmosCoinToERC20(ctx context.Context, in *MsgConvertCosmosCoinToERC20, opts ...grpc.CallOption) (*MsgConvertCosmosCoinToERC20Response, error)
|
||||||
|
// ConvertCosmosCoinFromERC20 defines a method for converting a cosmos sdk.Coin to an ERC20.
|
||||||
|
ConvertCosmosCoinFromERC20(ctx context.Context, in *MsgConvertCosmosCoinFromERC20, opts ...grpc.CallOption) (*MsgConvertCosmosCoinFromERC20Response, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type msgClient struct {
|
type msgClient struct {
|
||||||
@ -789,6 +1010,15 @@ func (c *msgClient) ConvertCosmosCoinToERC20(ctx context.Context, in *MsgConvert
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *msgClient) ConvertCosmosCoinFromERC20(ctx context.Context, in *MsgConvertCosmosCoinFromERC20, opts ...grpc.CallOption) (*MsgConvertCosmosCoinFromERC20Response, error) {
|
||||||
|
out := new(MsgConvertCosmosCoinFromERC20Response)
|
||||||
|
err := c.cc.Invoke(ctx, "/kava.evmutil.v1beta1.Msg/ConvertCosmosCoinFromERC20", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// MsgServer is the server API for Msg service.
|
// MsgServer is the server API for Msg service.
|
||||||
type MsgServer interface {
|
type MsgServer interface {
|
||||||
// ConvertCoinToERC20 defines a method for converting sdk.Coin to Kava ERC20.
|
// ConvertCoinToERC20 defines a method for converting sdk.Coin to Kava ERC20.
|
||||||
@ -797,6 +1027,8 @@ type MsgServer interface {
|
|||||||
ConvertERC20ToCoin(context.Context, *MsgConvertERC20ToCoin) (*MsgConvertERC20ToCoinResponse, error)
|
ConvertERC20ToCoin(context.Context, *MsgConvertERC20ToCoin) (*MsgConvertERC20ToCoinResponse, error)
|
||||||
// ConvertCosmosCoinToERC20 defines a method for converting a cosmos sdk.Coin to an ERC20.
|
// ConvertCosmosCoinToERC20 defines a method for converting a cosmos sdk.Coin to an ERC20.
|
||||||
ConvertCosmosCoinToERC20(context.Context, *MsgConvertCosmosCoinToERC20) (*MsgConvertCosmosCoinToERC20Response, error)
|
ConvertCosmosCoinToERC20(context.Context, *MsgConvertCosmosCoinToERC20) (*MsgConvertCosmosCoinToERC20Response, error)
|
||||||
|
// ConvertCosmosCoinFromERC20 defines a method for converting a cosmos sdk.Coin to an ERC20.
|
||||||
|
ConvertCosmosCoinFromERC20(context.Context, *MsgConvertCosmosCoinFromERC20) (*MsgConvertCosmosCoinFromERC20Response, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
|
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
|
||||||
@ -812,6 +1044,9 @@ func (*UnimplementedMsgServer) ConvertERC20ToCoin(ctx context.Context, req *MsgC
|
|||||||
func (*UnimplementedMsgServer) ConvertCosmosCoinToERC20(ctx context.Context, req *MsgConvertCosmosCoinToERC20) (*MsgConvertCosmosCoinToERC20Response, error) {
|
func (*UnimplementedMsgServer) ConvertCosmosCoinToERC20(ctx context.Context, req *MsgConvertCosmosCoinToERC20) (*MsgConvertCosmosCoinToERC20Response, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ConvertCosmosCoinToERC20 not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method ConvertCosmosCoinToERC20 not implemented")
|
||||||
}
|
}
|
||||||
|
func (*UnimplementedMsgServer) ConvertCosmosCoinFromERC20(ctx context.Context, req *MsgConvertCosmosCoinFromERC20) (*MsgConvertCosmosCoinFromERC20Response, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method ConvertCosmosCoinFromERC20 not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
|
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
|
||||||
s.RegisterService(&_Msg_serviceDesc, srv)
|
s.RegisterService(&_Msg_serviceDesc, srv)
|
||||||
@ -871,6 +1106,24 @@ func _Msg_ConvertCosmosCoinToERC20_Handler(srv interface{}, ctx context.Context,
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Msg_ConvertCosmosCoinFromERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(MsgConvertCosmosCoinFromERC20)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(MsgServer).ConvertCosmosCoinFromERC20(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/kava.evmutil.v1beta1.Msg/ConvertCosmosCoinFromERC20",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(MsgServer).ConvertCosmosCoinFromERC20(ctx, req.(*MsgConvertCosmosCoinFromERC20))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
var _Msg_serviceDesc = grpc.ServiceDesc{
|
var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "kava.evmutil.v1beta1.Msg",
|
ServiceName: "kava.evmutil.v1beta1.Msg",
|
||||||
HandlerType: (*MsgServer)(nil),
|
HandlerType: (*MsgServer)(nil),
|
||||||
@ -887,6 +1140,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "ConvertCosmosCoinToERC20",
|
MethodName: "ConvertCosmosCoinToERC20",
|
||||||
Handler: _Msg_ConvertCosmosCoinToERC20_Handler,
|
Handler: _Msg_ConvertCosmosCoinToERC20_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ConvertCosmosCoinFromERC20",
|
||||||
|
Handler: _Msg_ConvertCosmosCoinFromERC20_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "kava/evmutil/v1beta1/tx.proto",
|
Metadata: "kava/evmutil/v1beta1/tx.proto",
|
||||||
@ -1113,6 +1370,78 @@ func (m *MsgConvertCosmosCoinToERC20Response) MarshalToSizedBuffer(dAtA []byte)
|
|||||||
return len(dAtA) - i, nil
|
return len(dAtA) - i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20) 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 *MsgConvertCosmosCoinFromERC20) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20) 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 *MsgConvertCosmosCoinFromERC20Response) 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 *MsgConvertCosmosCoinFromERC20Response) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20Response) 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 {
|
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
|
||||||
offset -= sovTx(v)
|
offset -= sovTx(v)
|
||||||
base := offset
|
base := offset
|
||||||
@ -1216,6 +1545,36 @@ func (m *MsgConvertCosmosCoinToERC20Response) Size() (n int) {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20) 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 *MsgConvertCosmosCoinFromERC20Response) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
func sovTx(x uint64) (n int) {
|
func sovTx(x uint64) (n int) {
|
||||||
return (math_bits.Len64(x|1) + 6) / 7
|
return (math_bits.Len64(x|1) + 6) / 7
|
||||||
}
|
}
|
||||||
@ -1852,6 +2211,206 @@ func (m *MsgConvertCosmosCoinToERC20Response) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (m *MsgConvertCosmosCoinFromERC20) 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: MsgConvertCosmosCoinFromERC20: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: MsgConvertCosmosCoinFromERC20: 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 *MsgConvertCosmosCoinFromERC20Response) 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: MsgConvertCosmosCoinFromERC20Response: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: MsgConvertCosmosCoinFromERC20Response: 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) {
|
func skipTx(dAtA []byte) (n int, err error) {
|
||||||
l := len(dAtA)
|
l := len(dAtA)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
|
Loading…
Reference in New Issue
Block a user