-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added metoken queries to cosmwasm and stargate queries (#2177)
* Add metoken queries to cosmwasm and stargate queries * added tests for stargate and cosmwasm metoken queries * fix the lint * address the pr comments
- Loading branch information
Showing
9 changed files
with
225 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package query | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/gogo/protobuf/proto" | ||
"github.com/umee-network/umee/v5/x/metoken" | ||
) | ||
|
||
// HandleMeTokenParams handles the get for x/metoken module's parameters. | ||
func (q UmeeQuery) HandleMeTokenParams( | ||
ctx context.Context, | ||
qs metoken.QueryServer, | ||
) (proto.Message, error) { | ||
return qs.Params(ctx, &metoken.QueryParams{}) | ||
} | ||
|
||
// HandleMeTokenIndexes handles the get for x/metoken indexes. | ||
func (q UmeeQuery) HandleMeTokenIndexes( | ||
ctx context.Context, | ||
qs metoken.QueryServer, | ||
) (proto.Message, error) { | ||
req := metoken.QueryIndexes{MetokenDenom: q.Indexes.MetokenDenom} | ||
return qs.Indexes(ctx, &req) | ||
} | ||
|
||
// HandleMeTokenSwapFee handles the get for x/metoken swap fee. | ||
func (q UmeeQuery) HandleMeTokenSwapFee( | ||
ctx context.Context, | ||
qs metoken.QueryServer, | ||
) (proto.Message, error) { | ||
req := metoken.QuerySwapFee{Asset: q.SwapFee.Asset, MetokenDenom: q.SwapFee.MetokenDenom} | ||
return qs.SwapFee(ctx, &req) | ||
} | ||
|
||
// HandleMeTokenRedeemFee handles the get for x/metoken redeem fee. | ||
func (q UmeeQuery) HandleMeTokenRedeemFee( | ||
ctx context.Context, | ||
qs metoken.QueryServer, | ||
) (proto.Message, error) { | ||
req := metoken.QueryRedeemFee{AssetDenom: q.RedeemFee.AssetDenom, Metoken: q.RedeemFee.Metoken} | ||
return qs.RedeemFee(ctx, &req) | ||
} | ||
|
||
// HandleMeTokenIndexBalances handles the get for x/metoken indexes balances. | ||
func (q UmeeQuery) HandleMeTokenIndexBalances( | ||
ctx context.Context, | ||
qs metoken.QueryServer, | ||
) (proto.Message, error) { | ||
req := metoken.QueryIndexBalances{MetokenDenom: q.IndexBalances.MetokenDenom} | ||
return qs.IndexBalances(ctx, &req) | ||
} | ||
|
||
// HandleMeTokenIndexPrice handles the get for x/metoken indexe price. | ||
func (q UmeeQuery) HandleMeTokenIndexPrice( | ||
ctx context.Context, | ||
qs metoken.QueryServer, | ||
) (proto.Message, error) { | ||
req := metoken.QueryIndexPrice{MetokenDenom: q.IndexPrice.MetokenDenom} | ||
return qs.IndexPrice(ctx, &req) | ||
} |
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
Binary file not shown.