feat(evmutil): Add DeployedCosmosCoinContracts query (#1605)

* add QueryDeployedCosmosCoinContracts proto

* also implement protobuf marshaler for InternalEVMAddress

* setup iteration & collection for deployed addrs

* rewrite grpc query tests

* support querying for all deployed contracts

* support querying by cosmos denom

* fix & test pagination

* remove unused iteration methods

* add CLI query command

* update changelog

* update spec

* add InternalEVMAddress.MarshalJSON test
This commit is contained in:
Robert Pirtle 2023-06-02 11:23:52 -07:00 committed by GitHub
parent 12e3dfecc3
commit d500cd1236
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1343 additions and 140 deletions

View File

@ -42,6 +42,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (evmutil) [#1598] Track deployed ERC20 contract addresses for representing cosmos coins in module state
- (evmutil) [#1603] Add MsgConvertCosmosCoinToERC20 for converting an sdk.Coin to an ERC20 in the EVM
- (evmutil) [#1604] Emit events for MsgConvertCosmosCoinToERC20: `message` & `convert_cosmos_coin_to_erc20`
- (evmutil) [#1605] Add query for deployed ERC20 contracts representing Cosmos coins in the EVM
### Client Breaking
- (evmutil) [#1603] Renamed error `ErrConversionNotEnabled` to `ErrEVMConversionNotEnabled`
@ -250,6 +251,7 @@ the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.38.4/CHANGELOG.md).
- [#257](https://github.com/Kava-Labs/kava/pulls/257) Include scripts to run
large-scale simulations remotely using aws-batch
[#1605]: https://github.com/Kava-Labs/kava/pull/1605
[#1604]: https://github.com/Kava-Labs/kava/pull/1604
[#1603]: https://github.com/Kava-Labs/kava/pull/1603
[#1598]: https://github.com/Kava-Labs/kava/pull/1598

View File

@ -256,6 +256,9 @@
- [Params](#kava.evmutil.v1beta1.Params)
- [kava/evmutil/v1beta1/query.proto](#kava/evmutil/v1beta1/query.proto)
- [DeployedCosmosCoinContract](#kava.evmutil.v1beta1.DeployedCosmosCoinContract)
- [QueryDeployedCosmosCoinContractsRequest](#kava.evmutil.v1beta1.QueryDeployedCosmosCoinContractsRequest)
- [QueryDeployedCosmosCoinContractsResponse](#kava.evmutil.v1beta1.QueryDeployedCosmosCoinContractsResponse)
- [QueryParamsRequest](#kava.evmutil.v1beta1.QueryParamsRequest)
- [QueryParamsResponse](#kava.evmutil.v1beta1.QueryParamsResponse)
@ -3779,6 +3782,54 @@ Params defines the evmutil module params
<a name="kava.evmutil.v1beta1.DeployedCosmosCoinContract"></a>
### DeployedCosmosCoinContract
DeployedCosmosCoinContract defines a deployed token contract to the evm representing a native cosmos-sdk coin
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `cosmos_denom` | [string](#string) | | |
| `address` | [string](#string) | | |
<a name="kava.evmutil.v1beta1.QueryDeployedCosmosCoinContractsRequest"></a>
### QueryDeployedCosmosCoinContractsRequest
QueryDeployedCosmosCoinContractsRequest defines the request type for Query/DeployedCosmosCoinContracts method.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `cosmos_denoms` | [string](#string) | repeated | optional query param to only return specific denoms in the list denoms that do not have deployed contracts will be omitted from the result must request fewer than 100 denoms at a time. |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. |
<a name="kava.evmutil.v1beta1.QueryDeployedCosmosCoinContractsResponse"></a>
### QueryDeployedCosmosCoinContractsResponse
QueryDeployedCosmosCoinContractsResponse defines the response type for the Query/DeployedCosmosCoinContracts method.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `deployed_cosmos_coin_contracts` | [DeployedCosmosCoinContract](#kava.evmutil.v1beta1.DeployedCosmosCoinContract) | repeated | deployed_cosmos_coin_contracts is a list of cosmos-sdk coin denom and its deployed contract address |
| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. |
<a name="kava.evmutil.v1beta1.QueryParamsRequest"></a>
### QueryParamsRequest
@ -3818,6 +3869,7 @@ Query defines the gRPC querier service for evmutil module
| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `Params` | [QueryParamsRequest](#kava.evmutil.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#kava.evmutil.v1beta1.QueryParamsResponse) | Params queries all parameters of the evmutil module. | GET|/kava/evmutil/v1beta1/params|
| `DeployedCosmosCoinContracts` | [QueryDeployedCosmosCoinContractsRequest](#kava.evmutil.v1beta1.QueryDeployedCosmosCoinContractsRequest) | [QueryDeployedCosmosCoinContractsResponse](#kava.evmutil.v1beta1.QueryDeployedCosmosCoinContractsResponse) | DeployedCosmosCoinContracts queries a list cosmos coin denom and their deployed erc20 address | GET|/kava/evmutil/v1beta1/deployed_cosmos_coin_contracts|
<!-- end services -->

View File

@ -1,13 +1,12 @@
syntax = "proto3";
package kava.evmutil.v1beta1;
import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "kava/evmutil/v1beta1/genesis.proto";
option go_package = "github.com/kava-labs/kava/x/evmutil/types";
option (gogoproto.equal_all) = true;
option (gogoproto.verbose_equal_all) = true;
// Query defines the gRPC querier service for evmutil module
service Query {
@ -15,6 +14,11 @@ service Query {
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/kava/evmutil/v1beta1/params";
}
// DeployedCosmosCoinContracts queries a list cosmos coin denom and their deployed erc20 address
rpc DeployedCosmosCoinContracts(QueryDeployedCosmosCoinContractsRequest) returns (QueryDeployedCosmosCoinContractsResponse) {
option (google.api.http).get = "/kava/evmutil/v1beta1/deployed_cosmos_coin_contracts";
}
}
// QueryParamsRequest defines the request type for querying x/evmutil parameters.
@ -24,3 +28,32 @@ message QueryParamsRequest {}
message QueryParamsResponse {
Params params = 1 [(gogoproto.nullable) = false];
}
// QueryDeployedCosmosCoinContractsRequest defines the request type for Query/DeployedCosmosCoinContracts method.
message QueryDeployedCosmosCoinContractsRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// optional query param to only return specific denoms in the list
// denoms that do not have deployed contracts will be omitted from the result
// must request fewer than 100 denoms at a time.
repeated string cosmos_denoms = 1;
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryDeployedCosmosCoinContractsResponse defines the response type for the Query/DeployedCosmosCoinContracts method.
message QueryDeployedCosmosCoinContractsResponse {
// deployed_cosmos_coin_contracts is a list of cosmos-sdk coin denom and its deployed contract address
repeated DeployedCosmosCoinContract deployed_cosmos_coin_contracts = 1 [(gogoproto.nullable) = false];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// DeployedCosmosCoinContract defines a deployed token contract to the evm representing a native cosmos-sdk coin
message DeployedCosmosCoinContract {
string cosmos_denom = 1;
string address = 2 [(gogoproto.customtype) = "InternalEVMAddress"];
}

View File

@ -6,6 +6,7 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/cosmos/cosmos-sdk/version"
"github.com/spf13/cobra"
@ -24,6 +25,7 @@ func GetQueryCmd() *cobra.Command {
cmds := []*cobra.Command{
QueryParamsCmd(),
QueryDeployedCosmosCoinContractsCmd(),
}
for _, cmd := range cmds {
@ -61,3 +63,43 @@ func QueryParamsCmd() *cobra.Command {
},
}
}
func QueryDeployedCosmosCoinContractsCmd() *cobra.Command {
var cosmosDenoms []string
cmdName := "deployed-cosmos-coin-contracts"
q := fmt.Sprintf("%[1]s q %[2]s %s", version.AppName, types.ModuleName, cmdName)
cmd := &cobra.Command{
Use: fmt.Sprintf("%s [--denoms denom1,denom2] [flags]", cmdName),
Short: "Query for deployed ERC20 contract addresses representing cosmos coins in the EVM",
Example: fmt.Sprintf("Query all:\n %s\n\nQuery by denom:\n %s --denoms denom1,denom2", q, q),
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
page, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
request := types.QueryDeployedCosmosCoinContractsRequest{
CosmosDenoms: cosmosDenoms,
Pagination: page,
}
res, err := queryClient.DeployedCosmosCoinContracts(context.Background(), &request)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddPaginationFlagsToCmd(cmd, cmdName)
cmd.Flags().StringSliceVar(&cosmosDenoms, "denoms", []string{}, fmt.Sprintf("(optional) Cosmos denoms to get addresses for. If no contract is deployed, the result will be omitted. Limit %d per query.", query.DefaultLimit))
return cmd
}

View File

@ -6,7 +6,9 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/kava-labs/kava/x/evmutil/types"
)
@ -33,3 +35,79 @@ func (s queryServer) Params(stdCtx context.Context, req *types.QueryParamsReques
return &types.QueryParamsResponse{Params: params}, nil
}
// DeployedCosmosCoinContracts gets contract addresses for deployed erc20 contracts
// representing cosmos-sdk coins
func (s queryServer) DeployedCosmosCoinContracts(
goCtx context.Context,
req *types.QueryDeployedCosmosCoinContractsRequest,
) (res *types.QueryDeployedCosmosCoinContractsResponse, err error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
if len(req.CosmosDenoms) > 0 {
res, err = getDeployedCosmosCoinContractsByDenoms(&s.keeper, ctx, req.CosmosDenoms)
} else {
// requesting no sdk denoms is a request for all denoms
res, err = getAllDeployedCosmosCoinContractsPage(&s.keeper, ctx, req.Pagination)
}
return res, err
}
// getAllDeployedCosmosCoinContractsPage gets a page of deployed contracts (no filtering)
func getAllDeployedCosmosCoinContractsPage(
k *Keeper, ctx sdk.Context, pagination *query.PageRequest,
) (*types.QueryDeployedCosmosCoinContractsResponse, error) {
contracts := make([]types.DeployedCosmosCoinContract, 0)
contractStore := prefix.NewStore(
ctx.KVStore(k.storeKey),
types.DeployedCosmosCoinContractKeyPrefix,
)
pageRes, err := query.FilteredPaginate(contractStore, pagination,
func(key []byte, value []byte, accumulate bool) (bool, error) {
if !accumulate {
return true, nil
}
address := types.BytesToInternalEVMAddress(value)
contract := types.DeployedCosmosCoinContract{
CosmosDenom: string(key),
Address: &address,
}
contracts = append(contracts, contract)
return true, nil
})
if err != nil {
return &types.QueryDeployedCosmosCoinContractsResponse{}, err
}
return &types.QueryDeployedCosmosCoinContractsResponse{
DeployedCosmosCoinContracts: contracts,
Pagination: pageRes,
}, nil
}
func getDeployedCosmosCoinContractsByDenoms(
k *Keeper, ctx sdk.Context, denoms []string,
) (*types.QueryDeployedCosmosCoinContractsResponse, error) {
if len(denoms) > query.DefaultLimit {
// forego dealing with pagination by rejecting reqs for >100 denoms
return nil, status.Errorf(codes.InvalidArgument, "maximum of %d denoms allowed per request", query.DefaultLimit)
}
contracts := make([]types.DeployedCosmosCoinContract, 0, len(denoms))
for _, denom := range denoms {
address, found := k.GetDeployedCosmosCoinContract(ctx, denom)
if !found {
continue
}
contracts = append(contracts, types.NewDeployedCosmosCoinContract(denom, address))
}
return &types.QueryDeployedCosmosCoinContractsResponse{
DeployedCosmosCoinContracts: contracts,
}, nil
}

View File

@ -2,36 +2,187 @@ package keeper_test
import (
"context"
"fmt"
"testing"
"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/stretchr/testify/suite"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/kava-labs/kava/app"
"github.com/kava-labs/kava/x/evmutil/keeper"
"github.com/kava-labs/kava/x/evmutil/testutil"
"github.com/kava-labs/kava/x/evmutil/types"
)
type GrpcQueryTestSuite struct {
testutil.Suite
type grpcQueryTestSuite struct {
suite.Suite
msgServer types.MsgServer
App app.TestApp
Keeper keeper.Keeper
Ctx sdk.Context
QueryClient types.QueryClient
}
func (suite *GrpcQueryTestSuite) SetupTest() {
suite.Suite.SetupTest()
suite.msgServer = keeper.NewMsgServerImpl(suite.App.GetEvmutilKeeper())
func (suite *grpcQueryTestSuite) SetupTest() {
suite.App = app.NewTestApp()
suite.App.InitializeFromGenesisStates()
suite.Keeper = suite.App.GetEvmutilKeeper()
suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1})
queryHelper := baseapp.NewQueryServerTestHelper(suite.Ctx, suite.App.InterfaceRegistry())
types.RegisterQueryServer(queryHelper, keeper.NewQueryServerImpl(suite.App.GetEvmutilKeeper()))
suite.QueryClient = types.NewQueryClient(queryHelper)
}
func TestGrpcQueryTestSuite(t *testing.T) {
suite.Run(t, new(GrpcQueryTestSuite))
suite.Run(t, new(grpcQueryTestSuite))
}
func (suite *GrpcQueryTestSuite) TestQueryParams() {
func (suite *grpcQueryTestSuite) TestQueryParams() {
expectedParams := types.DefaultParams()
expectedParams.AllowedCosmosDenoms = append(
expectedParams.AllowedCosmosDenoms,
types.NewAllowedCosmosCoinERC20Token("cosmos-denom", "Cosmos Coin", "COSMOS", 6),
)
expectedParams.EnabledConversionPairs = types.NewConversionPairs(
types.NewConversionPair(testutil.RandomInternalEVMAddress(), "evm-denom"),
types.NewConversionPair(testutil.RandomInternalEVMAddress(), "evm-denom2"),
)
suite.Keeper.SetParams(suite.Ctx, expectedParams)
params, err := suite.QueryClient.Params(
context.Background(),
&types.QueryParamsRequest{},
)
suite.Require().NoError(err)
suite.Require().Len(params.Params.EnabledConversionPairs, 1)
suite.Require().Equal(expectedParams, params.Params)
}
func (suite *grpcQueryTestSuite) TestQueryDeployedCosmosCoinContracts() {
suite.Run("returns no error when no contracts deployed", func() {
res, err := suite.QueryClient.DeployedCosmosCoinContracts(
context.Background(),
&types.QueryDeployedCosmosCoinContractsRequest{},
)
suite.NoError(err)
suite.Len(res.DeployedCosmosCoinContracts, 0)
})
// setup some deployed contracts
ibcDenom := "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2"
contracts := []types.DeployedCosmosCoinContract{
types.NewDeployedCosmosCoinContract("magic", testutil.RandomInternalEVMAddress()),
types.NewDeployedCosmosCoinContract("hard", testutil.RandomInternalEVMAddress()),
types.NewDeployedCosmosCoinContract(ibcDenom, testutil.RandomInternalEVMAddress()),
types.NewDeployedCosmosCoinContract("swap", testutil.RandomInternalEVMAddress()),
types.NewDeployedCosmosCoinContract("another-denom", testutil.RandomInternalEVMAddress()),
}
for _, c := range contracts {
suite.Keeper.SetDeployedCosmosCoinContract(suite.Ctx, c.CosmosDenom, *c.Address)
}
suite.Run("returns all deployed contract addresses", func() {
res, err := suite.QueryClient.DeployedCosmosCoinContracts(
context.Background(),
&types.QueryDeployedCosmosCoinContractsRequest{},
)
suite.NoError(err)
suite.ElementsMatch(contracts, res.DeployedCosmosCoinContracts)
})
suite.Run("returns deployed contract addresses for requested denoms", func() {
denoms := []string{ibcDenom, "another-denom", "magic"}
expectedContracts := []types.DeployedCosmosCoinContract{
contracts[2],
contracts[4],
contracts[0],
}
res, err := suite.QueryClient.DeployedCosmosCoinContracts(
context.Background(),
&types.QueryDeployedCosmosCoinContractsRequest{CosmosDenoms: denoms},
)
suite.NoError(err)
// equal because it respects requested order
suite.Equal(expectedContracts, res.DeployedCosmosCoinContracts)
})
suite.Run("un-deployed denoms get omitted from results", func() {
denoms := []string{"doesnt-exist", ibcDenom, "also-doesnt-exist", "another-denom", "magic"}
expectedContracts := []types.DeployedCosmosCoinContract{
contracts[2],
contracts[4],
contracts[0],
}
res, err := suite.QueryClient.DeployedCosmosCoinContracts(
context.Background(),
&types.QueryDeployedCosmosCoinContractsRequest{CosmosDenoms: denoms},
)
suite.NoError(err)
// equal because it respects requested order
suite.Equal(expectedContracts, res.DeployedCosmosCoinContracts)
})
suite.Run("manages pagination of >100 denoms when requesting all", func() {
// register 100 denoms
for i := 1; i <= 100; i++ {
suite.Keeper.SetDeployedCosmosCoinContract(
suite.Ctx,
fmt.Sprintf("denom-%d", i),
testutil.RandomInternalEVMAddress(),
)
}
// first page has 100 results
res, err := suite.QueryClient.DeployedCosmosCoinContracts(
context.Background(),
&types.QueryDeployedCosmosCoinContractsRequest{},
)
suite.NoError(err)
// equal because it respects requested order
suite.Len(res.DeployedCosmosCoinContracts, 100)
fmt.Println(res.Pagination)
suite.NotNil(res.Pagination.NextKey)
// 2nd page has the rest
res, err = suite.QueryClient.DeployedCosmosCoinContracts(
context.Background(),
&types.QueryDeployedCosmosCoinContractsRequest{
CosmosDenoms: []string{},
Pagination: &query.PageRequest{
Key: res.Pagination.NextKey,
},
},
)
suite.NoError(err)
// equal because it respects requested order
suite.Len(res.DeployedCosmosCoinContracts, len(contracts), "incorrect page 2 length")
suite.Nil(res.Pagination.NextKey)
})
suite.Run("rejects requests for >100 denoms", func() {
denoms := make([]string, 0, 101)
for i := 1; i <= 100; i++ {
denoms = append(denoms, fmt.Sprintf("nonexistent-%d", i))
}
// accepts 100 denoms
res, err := suite.QueryClient.DeployedCosmosCoinContracts(
context.Background(),
&types.QueryDeployedCosmosCoinContractsRequest{CosmosDenoms: denoms},
)
suite.NoError(err)
suite.Len(res.DeployedCosmosCoinContracts, 0)
// rejects 101
denoms = append(denoms, "nonexistent-101")
_, err = suite.QueryClient.DeployedCosmosCoinContracts(
context.Background(),
&types.QueryDeployedCosmosCoinContractsRequest{CosmosDenoms: denoms},
)
suite.ErrorContains(err, "maximum of 100 denoms allowed per request")
})
}

View File

@ -52,6 +52,8 @@ Only Cosmos co-chain denominations that are in the `AllowedCosmosDenoms` param (
`AllowedCosmosDenoms` can be altered through governance.
The ERC20 contracts are deployed and managed by x/evmutil. The contract is deployed on first convert of the coin. Once deployed, the addresses of the contracts can be queried via the `DeployedCosmosCoinContracts` query (`deployed_cosmos_coin_contracts` endpoint).
### EVM-Native Assets
ERC-20 tokens native to the EVM can be converted into an `sdk.Coin` in the Cosmos ecosystem. This works by transferring the tokens to `x/evmutil`'s module account and then minting an `sdk.Coin` to the receiver. Converting back is the inverse: the `sdk.Coin` of the initiator is burned and the original ERC-20 tokens that were locked into the module account are transferred back to the receiver.

View File

@ -160,7 +160,7 @@ func (suite *Suite) SetupTest() {
queryHelper := baseapp.NewQueryServerTestHelper(suite.Ctx, suite.App.InterfaceRegistry())
evmtypes.RegisterQueryServer(queryHelper, suite.App.GetEvmKeeper())
suite.QueryClientEvm = evmtypes.NewQueryClient(queryHelper)
types.RegisterQueryServer(queryHelper, keeper.NewQueryServerImpl(suite.App.GetEvmutilKeeper()))
types.RegisterQueryServer(queryHelper, keeper.NewQueryServerImpl(suite.Keeper))
suite.QueryClient = types.NewQueryClient(queryHelper)
// We need to commit so that the ethermint feemarket beginblock runs to set the minfee

View File

@ -1,6 +1,8 @@
package types
import (
"encoding/json"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/common"
@ -41,3 +43,33 @@ func NewInternalEVMAddressFromString(addrStr string) (InternalEVMAddress, error)
return NewInternalEVMAddress(addr), nil
}
// Equal checks if two InternalEVMAddress instances are equal.
func (addr InternalEVMAddress) Equal(other InternalEVMAddress) bool {
return addr.Address == other.Address
}
// MarshalTo implements the protobuf Marshaler interface.
func (addr InternalEVMAddress) MarshalTo(data []byte) (int, error) {
addressBytes := addr.Address.Bytes()
return copy(data, addressBytes[:]), nil
}
// MarshalJSON allows PrintProto to handle InternalEVMAddress
func (addr InternalEVMAddress) MarshalJSON() ([]byte, error) {
return json.Marshal(addr.Hex())
}
// Size implements protobuf Unmarshaler interface.
func (a InternalEVMAddress) Size() int {
return common.AddressLength
}
// Unmarshal implements the protobuf Unmarshaler interface.
func (addr *InternalEVMAddress) Unmarshal(data []byte) error {
if len(data) != common.AddressLength {
return errors.New("invalid data length for InternalEVMAddress")
}
addr.Address.SetBytes(data)
return nil
}

View File

@ -1,6 +1,7 @@
package types_test
import (
"fmt"
"testing"
"github.com/kava-labs/kava/x/evmutil/testutil"
@ -36,3 +37,53 @@ func TestInternalEVMAddress_NewInternalEVMAddressFromString(t *testing.T) {
require.ErrorContains(t, err, "string is not a hex address")
})
}
func TestInternalEVMAddress_ProtobufMarshaller(t *testing.T) {
t.Run("Equal", func(t *testing.T) {
addr := testutil.RandomEvmAddress()
require.True(t, types.NewInternalEVMAddress(addr).Equal(testutil.MustNewInternalEVMAddressFromString(addr.Hex())))
})
t.Run("MarshalTo", func(t *testing.T) {
addr := testutil.RandomInternalEVMAddress()
expectedBytes := addr.Bytes()
data := make([]byte, len(expectedBytes))
n, err := addr.MarshalTo(data)
require.NoError(t, err)
// check length
require.Equal(t, len(expectedBytes), n)
// check data
require.Equal(t, expectedBytes, data)
})
t.Run("MarshalJSON", func(t *testing.T) {
addr := testutil.RandomInternalEVMAddress()
expected := fmt.Sprintf("\"%s\"", addr.Hex())
marshalled, err := addr.MarshalJSON()
require.NoError(t, err)
require.Equal(t, expected, string(marshalled))
})
t.Run("Size", func(t *testing.T) {
addr := testutil.RandomInternalEVMAddress()
require.Equal(t, 20, addr.Size())
})
t.Run("Unmarshal", func(t *testing.T) {
addr := types.InternalEVMAddress{}
expectedAddress := testutil.RandomEvmAddress()
data := expectedAddress.Bytes()
err := addr.Unmarshal(data)
require.NoError(t, err)
// check address is properly set
require.Equal(t, expectedAddress, addr.Address)
// fails with invalid data length
invalidData := []byte{0xbe, 0xef}
err = addr.Unmarshal(invalidData)
require.ErrorContains(t, err, "invalid data length for InternalEVMAddress")
})
}

View File

@ -98,6 +98,14 @@ func validateConversionPairs(i interface{}) error {
// Cosmos SDK -> EVM
///////////////
// NewDeployedCosmosCoinContract returns a new DeployedCosmosCoinContract
func NewDeployedCosmosCoinContract(denom string, address InternalEVMAddress) DeployedCosmosCoinContract {
return DeployedCosmosCoinContract{
CosmosDenom: denom,
Address: &address,
}
}
// NewAllowedCosmosCoinERC20Token returns an AllowedCosmosCoinERC20Token
func NewAllowedCosmosCoinERC20Token(
cosmosDenom, name, symbol string,
@ -115,20 +123,20 @@ func NewAllowedCosmosCoinERC20Token(
func (token AllowedCosmosCoinERC20Token) Validate() error {
// disallow empty string fields
if err := sdk.ValidateDenom(token.CosmosDenom); err != nil {
return fmt.Errorf("allowed cosomos coin erc20 token's sdk denom is invalid: %v", err)
return fmt.Errorf("allowed cosmos coin erc20 token's sdk denom is invalid: %v", err)
}
if token.Name == "" {
return errors.New("allowed cosomos coin erc20 token's name cannot be empty")
return errors.New("allowed cosmos coin erc20 token's name cannot be empty")
}
if token.Symbol == "" {
return errors.New("allowed cosomos coin erc20 token's symbol cannot be empty")
return errors.New("allowed cosmos coin erc20 token's symbol cannot be empty")
}
// ensure decimals will properly cast to uint8 of erc20 spec
if token.Decimals > math.MaxUint8 {
return fmt.Errorf("allowed cosomos coin erc20 token's decimals must be less than 256, found %d", token.Decimals)
return fmt.Errorf("allowed cosmos coin erc20 token's decimals must be less than 256, found %d", token.Decimals)
}
return nil

View File

@ -36,6 +36,11 @@ func DeployedCosmosCoinContractKey(cosmosDenom string) []byte {
return append(DeployedCosmosCoinContractKeyPrefix, []byte(cosmosDenom)...)
}
// DenomFromDeployedCosmosCoinContractKey is the inverse of DeployedCosmosCoinContractKey
func DenomFromDeployedCosmosCoinContractKey(key []byte) string {
return string(key[1:])
}
// ModuleAddress is the native module address for EVM
var ModuleEVMAddress common.Address

View File

@ -0,0 +1,16 @@
package types_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/kava-labs/kava/x/evmutil/types"
)
func TestDeployedCosmosCoinContractKey(t *testing.T) {
denom := "magic"
key := types.DeployedCosmosCoinContractKey(denom)
require.Equal(t, key, append([]byte{0x01}, []byte(denom)...))
require.Equal(t, denom, types.DenomFromDeployedCosmosCoinContractKey(key))
}

View File

@ -6,6 +6,7 @@ package types
import (
context "context"
fmt "fmt"
query "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/gogo/protobuf/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
@ -111,137 +112,200 @@ func (m *QueryParamsResponse) GetParams() Params {
return Params{}
}
// QueryDeployedCosmosCoinContractsRequest defines the request type for Query/DeployedCosmosCoinContracts method.
type QueryDeployedCosmosCoinContractsRequest struct {
// optional query param to only return specific denoms in the list
// denoms that do not have deployed contracts will be omitted from the result
// must request fewer than 100 denoms at a time.
CosmosDenoms []string `protobuf:"bytes,1,rep,name=cosmos_denoms,json=cosmosDenoms,proto3" json:"cosmos_denoms,omitempty"`
// pagination defines an optional pagination for the request.
Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryDeployedCosmosCoinContractsRequest) Reset() {
*m = QueryDeployedCosmosCoinContractsRequest{}
}
func (m *QueryDeployedCosmosCoinContractsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryDeployedCosmosCoinContractsRequest) ProtoMessage() {}
func (*QueryDeployedCosmosCoinContractsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_4a8d0512331709e7, []int{2}
}
func (m *QueryDeployedCosmosCoinContractsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDeployedCosmosCoinContractsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDeployedCosmosCoinContractsRequest.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 *QueryDeployedCosmosCoinContractsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDeployedCosmosCoinContractsRequest.Merge(m, src)
}
func (m *QueryDeployedCosmosCoinContractsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryDeployedCosmosCoinContractsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDeployedCosmosCoinContractsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDeployedCosmosCoinContractsRequest proto.InternalMessageInfo
// QueryDeployedCosmosCoinContractsResponse defines the response type for the Query/DeployedCosmosCoinContracts method.
type QueryDeployedCosmosCoinContractsResponse struct {
// deployed_cosmos_coin_contracts is a list of cosmos-sdk coin denom and its deployed contract address
DeployedCosmosCoinContracts []DeployedCosmosCoinContract `protobuf:"bytes,1,rep,name=deployed_cosmos_coin_contracts,json=deployedCosmosCoinContracts,proto3" json:"deployed_cosmos_coin_contracts"`
// pagination defines the pagination in the response.
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryDeployedCosmosCoinContractsResponse) Reset() {
*m = QueryDeployedCosmosCoinContractsResponse{}
}
func (m *QueryDeployedCosmosCoinContractsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryDeployedCosmosCoinContractsResponse) ProtoMessage() {}
func (*QueryDeployedCosmosCoinContractsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_4a8d0512331709e7, []int{3}
}
func (m *QueryDeployedCosmosCoinContractsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryDeployedCosmosCoinContractsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryDeployedCosmosCoinContractsResponse.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 *QueryDeployedCosmosCoinContractsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryDeployedCosmosCoinContractsResponse.Merge(m, src)
}
func (m *QueryDeployedCosmosCoinContractsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryDeployedCosmosCoinContractsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryDeployedCosmosCoinContractsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryDeployedCosmosCoinContractsResponse proto.InternalMessageInfo
func (m *QueryDeployedCosmosCoinContractsResponse) GetDeployedCosmosCoinContracts() []DeployedCosmosCoinContract {
if m != nil {
return m.DeployedCosmosCoinContracts
}
return nil
}
func (m *QueryDeployedCosmosCoinContractsResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
// DeployedCosmosCoinContract defines a deployed token contract to the evm representing a native cosmos-sdk coin
type DeployedCosmosCoinContract struct {
CosmosDenom string `protobuf:"bytes,1,opt,name=cosmos_denom,json=cosmosDenom,proto3" json:"cosmos_denom,omitempty"`
Address *InternalEVMAddress `protobuf:"bytes,2,opt,name=address,proto3,customtype=InternalEVMAddress" json:"address,omitempty"`
}
func (m *DeployedCosmosCoinContract) Reset() { *m = DeployedCosmosCoinContract{} }
func (m *DeployedCosmosCoinContract) String() string { return proto.CompactTextString(m) }
func (*DeployedCosmosCoinContract) ProtoMessage() {}
func (*DeployedCosmosCoinContract) Descriptor() ([]byte, []int) {
return fileDescriptor_4a8d0512331709e7, []int{4}
}
func (m *DeployedCosmosCoinContract) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *DeployedCosmosCoinContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_DeployedCosmosCoinContract.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 *DeployedCosmosCoinContract) XXX_Merge(src proto.Message) {
xxx_messageInfo_DeployedCosmosCoinContract.Merge(m, src)
}
func (m *DeployedCosmosCoinContract) XXX_Size() int {
return m.Size()
}
func (m *DeployedCosmosCoinContract) XXX_DiscardUnknown() {
xxx_messageInfo_DeployedCosmosCoinContract.DiscardUnknown(m)
}
var xxx_messageInfo_DeployedCosmosCoinContract proto.InternalMessageInfo
func (m *DeployedCosmosCoinContract) GetCosmosDenom() string {
if m != nil {
return m.CosmosDenom
}
return ""
}
func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "kava.evmutil.v1beta1.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "kava.evmutil.v1beta1.QueryParamsResponse")
proto.RegisterType((*QueryDeployedCosmosCoinContractsRequest)(nil), "kava.evmutil.v1beta1.QueryDeployedCosmosCoinContractsRequest")
proto.RegisterType((*QueryDeployedCosmosCoinContractsResponse)(nil), "kava.evmutil.v1beta1.QueryDeployedCosmosCoinContractsResponse")
proto.RegisterType((*DeployedCosmosCoinContract)(nil), "kava.evmutil.v1beta1.DeployedCosmosCoinContract")
}
func init() { proto.RegisterFile("kava/evmutil/v1beta1/query.proto", fileDescriptor_4a8d0512331709e7) }
var fileDescriptor_4a8d0512331709e7 = []byte{
// 294 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0x31, 0x4b, 0xc4, 0x30,
0x18, 0x86, 0x1b, 0xd1, 0x0e, 0x71, 0x8b, 0x1d, 0xa4, 0x94, 0x78, 0x14, 0x87, 0xbb, 0xc1, 0x84,
0x3b, 0x37, 0xc7, 0x5b, 0x5d, 0xbc, 0x1b, 0xdd, 0x52, 0x09, 0xb1, 0xd8, 0xf6, 0xeb, 0x35, 0x69,
0xf1, 0x56, 0x9d, 0x05, 0xc1, 0x3f, 0xe1, 0x4f, 0xb9, 0xf1, 0xc0, 0xc5, 0x49, 0xce, 0xd6, 0x1f,
0x22, 0x6d, 0x8a, 0x20, 0x76, 0x70, 0x0b, 0x5f, 0x9e, 0xef, 0x79, 0xdf, 0x04, 0x8f, 0xee, 0x44,
0x25, 0xb8, 0xac, 0xd2, 0xd2, 0xc4, 0x09, 0xaf, 0xa6, 0x91, 0x34, 0x62, 0xca, 0x57, 0xa5, 0x2c,
0xd6, 0x2c, 0x2f, 0xc0, 0x00, 0xf1, 0x5a, 0x82, 0xf5, 0x04, 0xeb, 0x09, 0xdf, 0x53, 0xa0, 0xa0,
0x03, 0x78, 0x7b, 0xb2, 0xac, 0x1f, 0x28, 0x00, 0x95, 0x48, 0x2e, 0xf2, 0x98, 0x8b, 0x2c, 0x03,
0x23, 0x4c, 0x0c, 0x99, 0xee, 0x6f, 0xc3, 0xc1, 0x2c, 0x25, 0x33, 0xa9, 0xe3, 0x9e, 0x09, 0x3d,
0x4c, 0x16, 0x6d, 0xf8, 0x95, 0x28, 0x44, 0xaa, 0x97, 0x72, 0x55, 0x4a, 0x6d, 0xc2, 0x05, 0x3e,
0xfa, 0x35, 0xd5, 0x39, 0x64, 0x5a, 0x92, 0x0b, 0xec, 0xe6, 0xdd, 0xe4, 0x18, 0x8d, 0xd0, 0xf8,
0x70, 0x16, 0xb0, 0xa1, 0xae, 0xcc, 0x6e, 0xcd, 0xf7, 0x37, 0x1f, 0x27, 0xce, 0xb2, 0xdf, 0x98,
0x3d, 0x21, 0x7c, 0xd0, 0x39, 0xc9, 0x23, 0xc2, 0xae, 0x45, 0xc8, 0x78, 0x58, 0xf0, 0xb7, 0x91,
0x3f, 0xf9, 0x07, 0x69, 0x5b, 0x86, 0xa7, 0x0f, 0x6f, 0x5f, 0x2f, 0x7b, 0x94, 0x04, 0x7c, 0xf0,
0xfd, 0xb6, 0xcf, 0xfc, 0x72, 0xf7, 0x49, 0xd1, 0x6b, 0x4d, 0xd1, 0xa6, 0xa6, 0x68, 0x5b, 0x53,
0xb4, 0xab, 0x29, 0x7a, 0x6e, 0xa8, 0xb3, 0x6d, 0xa8, 0xf3, 0xde, 0x50, 0xe7, 0x7a, 0xa2, 0x62,
0x73, 0x5b, 0x46, 0xec, 0x06, 0xd2, 0xce, 0x74, 0x96, 0x88, 0x48, 0x5b, 0xe7, 0xfd, 0x8f, 0xd5,
0xac, 0x73, 0xa9, 0x23, 0xb7, 0xfb, 0xcc, 0xf3, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xeb, 0xa2,
0x8d, 0x8c, 0xde, 0x01, 0x00, 0x00,
}
func (this *QueryParamsRequest) VerboseEqual(that interface{}) error {
if that == nil {
if this == nil {
return nil
}
return fmt.Errorf("that == nil && this != nil")
}
that1, ok := that.(*QueryParamsRequest)
if !ok {
that2, ok := that.(QueryParamsRequest)
if ok {
that1 = &that2
} else {
return fmt.Errorf("that is not of type *QueryParamsRequest")
}
}
if that1 == nil {
if this == nil {
return nil
}
return fmt.Errorf("that is type *QueryParamsRequest but is nil && this != nil")
} else if this == nil {
return fmt.Errorf("that is type *QueryParamsRequest but is not nil && this == nil")
}
return nil
}
func (this *QueryParamsRequest) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*QueryParamsRequest)
if !ok {
that2, ok := that.(QueryParamsRequest)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
return true
}
func (this *QueryParamsResponse) VerboseEqual(that interface{}) error {
if that == nil {
if this == nil {
return nil
}
return fmt.Errorf("that == nil && this != nil")
}
that1, ok := that.(*QueryParamsResponse)
if !ok {
that2, ok := that.(QueryParamsResponse)
if ok {
that1 = &that2
} else {
return fmt.Errorf("that is not of type *QueryParamsResponse")
}
}
if that1 == nil {
if this == nil {
return nil
}
return fmt.Errorf("that is type *QueryParamsResponse but is nil && this != nil")
} else if this == nil {
return fmt.Errorf("that is type *QueryParamsResponse but is not nil && this == nil")
}
if !this.Params.Equal(&that1.Params) {
return fmt.Errorf("Params this(%v) Not Equal that(%v)", this.Params, that1.Params)
}
return nil
}
func (this *QueryParamsResponse) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*QueryParamsResponse)
if !ok {
that2, ok := that.(QueryParamsResponse)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if !this.Params.Equal(&that1.Params) {
return false
}
return true
// 542 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4f, 0x6f, 0xd3, 0x30,
0x14, 0x8f, 0x0b, 0x14, 0xea, 0x8e, 0x8b, 0xa9, 0xd0, 0xd4, 0x55, 0xe9, 0x08, 0x88, 0x75, 0x48,
0x38, 0x5b, 0x41, 0x1c, 0x26, 0x40, 0xa2, 0x1d, 0x20, 0x0e, 0x48, 0x2c, 0x07, 0x0e, 0x5c, 0x2a,
0x27, 0xb1, 0x42, 0x44, 0x6a, 0xa7, 0xb1, 0x5b, 0x51, 0x71, 0x83, 0x0b, 0x47, 0x24, 0xbe, 0x40,
0x3f, 0xce, 0x8e, 0x93, 0xb8, 0xa0, 0x1d, 0x26, 0xd4, 0x72, 0x40, 0x9c, 0xf8, 0x08, 0xa8, 0xb6,
0xbb, 0x15, 0x91, 0xb6, 0x88, 0x9b, 0xf5, 0xfc, 0x7b, 0xfe, 0xfd, 0x79, 0x2f, 0x81, 0x9b, 0x6f,
0xc8, 0x80, 0xb8, 0x74, 0xd0, 0xed, 0xcb, 0x38, 0x71, 0x07, 0xbb, 0x3e, 0x95, 0x64, 0xd7, 0xed,
0xf5, 0x69, 0x36, 0xc4, 0x69, 0xc6, 0x25, 0x47, 0x95, 0x29, 0x02, 0x1b, 0x04, 0x36, 0x88, 0xea,
0xad, 0x80, 0x8b, 0x2e, 0x17, 0xae, 0x4f, 0x04, 0xd5, 0xf0, 0xd3, 0xe6, 0x94, 0x44, 0x31, 0x23,
0x32, 0xe6, 0x4c, 0xbf, 0x50, 0xad, 0x44, 0x3c, 0xe2, 0xea, 0xe8, 0x4e, 0x4f, 0xa6, 0x5a, 0x8b,
0x38, 0x8f, 0x12, 0xea, 0x92, 0x34, 0x76, 0x09, 0x63, 0x5c, 0xaa, 0x16, 0x61, 0x6e, 0x9d, 0x5c,
0x5d, 0x11, 0x65, 0x54, 0xc4, 0x06, 0xe3, 0x54, 0x20, 0x3a, 0x98, 0x32, 0xbf, 0x20, 0x19, 0xe9,
0x0a, 0x8f, 0xf6, 0xfa, 0x54, 0x48, 0xe7, 0x00, 0x5e, 0xf9, 0xa3, 0x2a, 0x52, 0xce, 0x04, 0x45,
0x7b, 0xb0, 0x98, 0xaa, 0xca, 0x3a, 0xd8, 0x04, 0x8d, 0x72, 0xb3, 0x86, 0xf3, 0x7c, 0x61, 0xdd,
0xd5, 0x3a, 0x7f, 0x78, 0x52, 0xb7, 0x3c, 0xd3, 0xe1, 0x8c, 0x00, 0xdc, 0x52, 0x6f, 0xee, 0xd3,
0x34, 0xe1, 0x43, 0x1a, 0xb6, 0x95, 0xf9, 0x36, 0x8f, 0x59, 0x9b, 0x33, 0x99, 0x91, 0x40, 0xce,
0xe8, 0xd1, 0x75, 0x78, 0x59, 0x47, 0xd3, 0x09, 0x29, 0xe3, 0x8a, 0xee, 0x5c, 0xa3, 0xe4, 0xad,
0xe9, 0xe2, 0xbe, 0xaa, 0xa1, 0x27, 0x10, 0x9e, 0xa5, 0xb4, 0x5e, 0x50, 0x82, 0x6e, 0x62, 0x0d,
0xc1, 0xd3, 0x48, 0xb1, 0x9e, 0xc0, 0x99, 0xaa, 0x88, 0x1a, 0x02, 0x6f, 0xae, 0x73, 0xef, 0xd2,
0xc7, 0x51, 0xdd, 0xfa, 0x31, 0xaa, 0x5b, 0xce, 0x2f, 0x00, 0x1b, 0xab, 0x25, 0x9a, 0x2c, 0xde,
0x41, 0x3b, 0x34, 0xb0, 0x8e, 0x11, 0x1b, 0xf0, 0x98, 0x75, 0x82, 0x19, 0x52, 0x89, 0x2e, 0x37,
0x77, 0xf2, 0x33, 0x5a, 0x4c, 0x61, 0x72, 0xdb, 0x08, 0x17, 0x8b, 0x40, 0x4f, 0x73, 0xbc, 0x6f,
0xad, 0xf4, 0xae, 0x95, 0xcf, 0x9b, 0x77, 0x7a, 0xb0, 0xba, 0x58, 0x09, 0xba, 0x06, 0xd7, 0xe6,
0xe7, 0xa0, 0xa6, 0x5e, 0xf2, 0xca, 0x73, 0x63, 0x40, 0x3b, 0xf0, 0x22, 0x09, 0xc3, 0x8c, 0x0a,
0xa1, 0x64, 0x94, 0x5a, 0x57, 0x8f, 0x4f, 0xea, 0xe8, 0x19, 0x93, 0x34, 0x63, 0x24, 0x79, 0xfc,
0xf2, 0xf9, 0x23, 0x7d, 0xeb, 0xcd, 0x60, 0xcd, 0x9f, 0x05, 0x78, 0x41, 0xa5, 0x8c, 0x3e, 0x00,
0x58, 0xd4, 0xbb, 0x82, 0x1a, 0xf9, 0x29, 0xfd, 0xbd, 0x9a, 0xd5, 0xed, 0x7f, 0x40, 0x6a, 0xa3,
0xce, 0x8d, 0xf7, 0x5f, 0xbe, 0x7f, 0x2e, 0xd8, 0xa8, 0xe6, 0xe6, 0x7e, 0x08, 0x7a, 0x31, 0xd1,
0x31, 0x80, 0x1b, 0x4b, 0x06, 0x8e, 0x1e, 0x2c, 0x21, 0x5c, 0xbd, 0xcb, 0xd5, 0x87, 0xff, 0xdb,
0x6e, 0x4c, 0xdc, 0x57, 0x26, 0xee, 0xa1, 0xbb, 0xf9, 0x26, 0x96, 0xef, 0x60, 0xab, 0x7d, 0x38,
0xb6, 0xc1, 0xd1, 0xd8, 0x06, 0xdf, 0xc6, 0x36, 0xf8, 0x34, 0xb1, 0xad, 0xa3, 0x89, 0x6d, 0x7d,
0x9d, 0xd8, 0xd6, 0xab, 0xed, 0x28, 0x96, 0xaf, 0xfb, 0x3e, 0x0e, 0x78, 0x57, 0xbd, 0x7c, 0x3b,
0x21, 0xbe, 0xd0, 0x1c, 0x6f, 0x4f, 0x59, 0xe4, 0x30, 0xa5, 0xc2, 0x2f, 0xaa, 0x5f, 0xc5, 0x9d,
0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x1f, 0xfa, 0x86, 0x41, 0xe8, 0x04, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -258,6 +322,8 @@ const _ = grpc.SupportPackageIsVersion4
type QueryClient interface {
// Params queries all parameters of the evmutil module.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// DeployedCosmosCoinContracts queries a list cosmos coin denom and their deployed erc20 address
DeployedCosmosCoinContracts(ctx context.Context, in *QueryDeployedCosmosCoinContractsRequest, opts ...grpc.CallOption) (*QueryDeployedCosmosCoinContractsResponse, error)
}
type queryClient struct {
@ -277,10 +343,21 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
return out, nil
}
func (c *queryClient) DeployedCosmosCoinContracts(ctx context.Context, in *QueryDeployedCosmosCoinContractsRequest, opts ...grpc.CallOption) (*QueryDeployedCosmosCoinContractsResponse, error) {
out := new(QueryDeployedCosmosCoinContractsResponse)
err := c.cc.Invoke(ctx, "/kava.evmutil.v1beta1.Query/DeployedCosmosCoinContracts", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
type QueryServer interface {
// Params queries all parameters of the evmutil module.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// DeployedCosmosCoinContracts queries a list cosmos coin denom and their deployed erc20 address
DeployedCosmosCoinContracts(context.Context, *QueryDeployedCosmosCoinContractsRequest) (*QueryDeployedCosmosCoinContractsResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -290,6 +367,9 @@ type UnimplementedQueryServer struct {
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func (*UnimplementedQueryServer) DeployedCosmosCoinContracts(ctx context.Context, req *QueryDeployedCosmosCoinContractsRequest) (*QueryDeployedCosmosCoinContractsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeployedCosmosCoinContracts not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
@ -313,6 +393,24 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf
return interceptor(ctx, in, info, handler)
}
func _Query_DeployedCosmosCoinContracts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDeployedCosmosCoinContractsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).DeployedCosmosCoinContracts(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/kava.evmutil.v1beta1.Query/DeployedCosmosCoinContracts",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).DeployedCosmosCoinContracts(ctx, req.(*QueryDeployedCosmosCoinContractsRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "kava.evmutil.v1beta1.Query",
HandlerType: (*QueryServer)(nil),
@ -321,6 +419,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "Params",
Handler: _Query_Params_Handler,
},
{
MethodName: "DeployedCosmosCoinContracts",
Handler: _Query_DeployedCosmosCoinContracts_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "kava/evmutil/v1beta1/query.proto",
@ -382,6 +484,141 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *QueryDeployedCosmosCoinContractsRequest) 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 *QueryDeployedCosmosCoinContractsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDeployedCosmosCoinContractsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.CosmosDenoms) > 0 {
for iNdEx := len(m.CosmosDenoms) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.CosmosDenoms[iNdEx])
copy(dAtA[i:], m.CosmosDenoms[iNdEx])
i = encodeVarintQuery(dAtA, i, uint64(len(m.CosmosDenoms[iNdEx])))
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *QueryDeployedCosmosCoinContractsResponse) 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 *QueryDeployedCosmosCoinContractsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryDeployedCosmosCoinContractsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Pagination != nil {
{
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.DeployedCosmosCoinContracts) > 0 {
for iNdEx := len(m.DeployedCosmosCoinContracts) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.DeployedCosmosCoinContracts[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *DeployedCosmosCoinContract) 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 *DeployedCosmosCoinContract) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *DeployedCosmosCoinContract) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Address != nil {
{
size := m.Address.Size()
i -= size
if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.CosmosDenom) > 0 {
i -= len(m.CosmosDenom)
copy(dAtA[i:], m.CosmosDenom)
i = encodeVarintQuery(dAtA, i, uint64(len(m.CosmosDenom)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v)
base := offset
@ -413,6 +650,61 @@ func (m *QueryParamsResponse) Size() (n int) {
return n
}
func (m *QueryDeployedCosmosCoinContractsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.CosmosDenoms) > 0 {
for _, s := range m.CosmosDenoms {
l = len(s)
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryDeployedCosmosCoinContractsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.DeployedCosmosCoinContracts) > 0 {
for _, e := range m.DeployedCosmosCoinContracts {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *DeployedCosmosCoinContract) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.CosmosDenom)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.Address != nil {
l = m.Address.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -552,6 +844,362 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *QueryDeployedCosmosCoinContractsRequest) 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 ErrIntOverflowQuery
}
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: QueryDeployedCosmosCoinContractsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDeployedCosmosCoinContractsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CosmosDenoms", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CosmosDenoms = append(m.CosmosDenoms, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryDeployedCosmosCoinContractsResponse) 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 ErrIntOverflowQuery
}
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: QueryDeployedCosmosCoinContractsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryDeployedCosmosCoinContractsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DeployedCosmosCoinContracts", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DeployedCosmosCoinContracts = append(m.DeployedCosmosCoinContracts, DeployedCosmosCoinContract{})
if err := m.DeployedCosmosCoinContracts[len(m.DeployedCosmosCoinContracts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *DeployedCosmosCoinContract) 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 ErrIntOverflowQuery
}
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: DeployedCosmosCoinContract: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: DeployedCosmosCoinContract: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CosmosDenom", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CosmosDenom = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
var v InternalEVMAddress
m.Address = &v
if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0

View File

@ -51,6 +51,42 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal
}
var (
filter_Query_DeployedCosmosCoinContracts_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_DeployedCosmosCoinContracts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryDeployedCosmosCoinContractsRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DeployedCosmosCoinContracts_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.DeployedCosmosCoinContracts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_DeployedCosmosCoinContracts_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryDeployedCosmosCoinContractsRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DeployedCosmosCoinContracts_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.DeployedCosmosCoinContracts(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@ -80,6 +116,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
mux.Handle("GET", pattern_Query_DeployedCosmosCoinContracts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_DeployedCosmosCoinContracts_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_DeployedCosmosCoinContracts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -141,13 +200,37 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
mux.Handle("GET", pattern_Query_DeployedCosmosCoinContracts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_DeployedCosmosCoinContracts_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_DeployedCosmosCoinContracts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "evmutil", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_DeployedCosmosCoinContracts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "evmutil", "v1beta1", "deployed_cosmos_coin_contracts"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Query_Params_0 = runtime.ForwardResponseMessage
forward_Query_DeployedCosmosCoinContracts_0 = runtime.ForwardResponseMessage
)