-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/develop' into develop
- Loading branch information
Showing
12 changed files
with
870 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package cli | ||
|
||
import ( | ||
"github.com/ExocoreNetwork/exocore/x/oracle/types" | ||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func CmdQueryTokenIndexes() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "show-tokens", | ||
Short: "shows the list of token-index mapping", | ||
Args: cobra.NoArgs, | ||
RunE: func(cmd *cobra.Command, _ []string) (err error) { | ||
clientCtx, err := client.GetClientQueryContext(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
queryClient := types.NewQueryClient(clientCtx) | ||
|
||
res, err := queryClient.TokenIndexes(cmd.Context(), &types.QueryTokenIndexesRequest{}) | ||
if err != nil { | ||
return err | ||
} | ||
return clientCtx.PrintProto(res) | ||
}, | ||
} | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package keeper | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/ExocoreNetwork/exocore/x/oracle/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"google.golang.org/grpc/codes" | ||
"google.golang.org/grpc/status" | ||
) | ||
|
||
func (k Keeper) TokenIndexes(goCtx context.Context, req *types.QueryTokenIndexesRequest) (*types.QueryTokenIndexesResponse, error) { | ||
if req == nil { | ||
return nil, status.Error(codes.InvalidArgument, "invalid request") | ||
} | ||
|
||
ctx := sdk.UnwrapSDKContext(goCtx) | ||
ret := k.GetTokens(ctx) | ||
return &types.QueryTokenIndexesResponse{ | ||
TokenIndexes: ret, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package keeper | ||
|
||
import ( | ||
"github.com/ExocoreNetwork/exocore/x/oracle/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
// GetTokens returns a list of token-index mapping registered in params | ||
func (k Keeper) GetTokens(ctx sdk.Context) []*types.TokenIndex { | ||
params := k.GetParams(ctx) | ||
ret := make([]*types.TokenIndex, 0, len(params.Tokens)) | ||
for idx, token := range params.Tokens { | ||
ret = append(ret, &types.TokenIndex{ | ||
Token: token.Name, | ||
Index: uint64(idx), | ||
}) | ||
} | ||
return ret | ||
} |
Oops, something went wrong.