From 22ab369e18e9f14b65e4b807915c29df65d7260d Mon Sep 17 00:00:00 2001 From: jgo121 Date: Wed, 29 May 2024 21:38:17 +0800 Subject: [PATCH] tokens module refactoring and token minting in other modules to use tokens module --- app/app.go | 11 +- proto/kira/tokens/genesis.proto | 5 +- proto/kira/tokens/query.proto | 8 +- x/basket/keeper/keeper.go | 5 +- x/basket/keeper/mint_burn_swap.go | 2 +- x/basket/types/expected_keepers.go | 8 + x/genutil/client/cli/init.go | 2 +- x/gov/types/permission.pb.go | 223 +++++++++++------------ x/layer2/keeper/abci.go | 2 +- x/layer2/keeper/keeper.go | 9 +- x/layer2/keeper/msg_server.go | 2 +- x/layer2/types/expected_keepers.go | 7 + x/multistaking/keeper/delegation.go | 2 +- x/multistaking/types/expected_keepers.go | 3 +- x/recovery/keeper/keeper.go | 3 + x/recovery/keeper/msg_server.go | 2 +- x/recovery/types/expected_keepers.go | 7 + x/tokens/handler_test.go | 2 +- x/tokens/keeper/freeze.go | 36 ++-- x/tokens/keeper/freeze_test.go | 4 +- x/tokens/keeper/grpc_query.go | 34 ++-- x/tokens/keeper/grpc_query_test.go | 12 +- x/tokens/keeper/mint.go | 29 +++ x/tokens/keeper/msg_server.go | 2 +- x/tokens/keeper/token_info.go | 29 ++- x/tokens/keeper/token_info_test.go | 8 +- x/tokens/module.go | 2 +- x/tokens/proposal_handler.go | 2 +- x/tokens/types/expected_keepers.go | 2 + x/tokens/types/genesis.go | 4 +- x/tokens/types/genesis.pb.go | 68 ++++--- x/tokens/types/query.pb.go | 209 ++++++++++++--------- x/tokens/types/types.go | 4 +- x/ubi/keeper/keeper.go | 9 +- x/ubi/keeper/ubi.go | 2 +- x/ubi/types/expected_keepers.go | 7 + 36 files changed, 439 insertions(+), 327 deletions(-) create mode 100644 x/tokens/keeper/mint.go diff --git a/app/app.go b/app/app.go index 20614294d..de96cb965 100644 --- a/app/app.go +++ b/app/app.go @@ -316,6 +316,7 @@ func NewInitApp( app.CustomStakingKeeper, app.CustomGovKeeper, app.SpendingKeeper, + app.TokensKeeper, ) app.UpgradeKeeper = upgradekeeper.NewKeeper(keys[upgradetypes.StoreKey], appCodec, app.CustomStakingKeeper) @@ -346,6 +347,7 @@ func NewInitApp( app.CollectivesKeeper, app.SpendingKeeper, app.CustodyKeeper, + app.TokensKeeper, ) app.DistrKeeper = distributorkeeper.NewKeeper( @@ -354,7 +356,14 @@ func NewInitApp( app.CustomStakingKeeper, app.CustomGovKeeper, app.MultiStakingKeeper, app.RecoveryKeeper) app.MultiStakingKeeper.SetDistrKeeper(app.DistrKeeper) - app.UbiKeeper = ubikeeper.NewKeeper(keys[ubitypes.ModuleName], appCodec, app.BankKeeper, app.SpendingKeeper, app.DistrKeeper) + app.UbiKeeper = ubikeeper.NewKeeper( + keys[ubitypes.ModuleName], + appCodec, + app.BankKeeper, + app.SpendingKeeper, + app.DistrKeeper, + app.TokensKeeper, + ) proposalRouter := govtypes.NewProposalRouter( []govtypes.ProposalHandler{ diff --git a/proto/kira/tokens/genesis.proto b/proto/kira/tokens/genesis.proto index 2f0392702..785b08796 100644 --- a/proto/kira/tokens/genesis.proto +++ b/proto/kira/tokens/genesis.proto @@ -1,12 +1,13 @@ syntax = "proto3"; package kira.tokens; +import "gogoproto/gogo.proto"; import "kira/tokens/token.proto"; import "kira/tokens/freeze.proto"; option go_package = "github.com/KiraCore/sekai/x/tokens/types"; message GenesisState { - repeated kira.tokens.TokenInfo tokenInfos = 1; - TokensWhiteBlack tokenBlackWhites = 2; + repeated kira.tokens.TokenInfo tokenInfos = 1 [ (gogoproto.nullable) = false ]; + TokensWhiteBlack tokenBlackWhites = 2 [ (gogoproto.nullable) = false ]; } diff --git a/proto/kira/tokens/query.proto b/proto/kira/tokens/query.proto index c5759cc80..82dbbb625 100644 --- a/proto/kira/tokens/query.proto +++ b/proto/kira/tokens/query.proto @@ -5,6 +5,7 @@ import "kira/tokens/token.proto"; import "kira/tokens/freeze.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; +import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/KiraCore/sekai/x/tokens/types"; @@ -32,12 +33,13 @@ message TokenInfoRequest { message TokenInfoResponse { kira.tokens.TokenInfo data = 1; + cosmos.base.v1beta1.Coin supply = 2 [(gogoproto.nullable) = false]; } message AllTokenInfosRequest {} message AllTokenInfosResponse { - repeated kira.tokens.TokenInfo data = 1; + repeated TokenInfoResponse data = 1 [ (gogoproto.nullable) = false ]; } message TokenInfosByDenomRequest { @@ -45,10 +47,10 @@ message TokenInfosByDenomRequest { } message TokenInfosByDenomResponse { - map data = 1; + map data = 1 [ (gogoproto.nullable) = false ]; } message TokenBlackWhitesRequest {} message TokenBlackWhitesResponse { - TokensWhiteBlack data = 1; + TokensWhiteBlack data = 1 [ (gogoproto.nullable) = false ]; } \ No newline at end of file diff --git a/x/basket/keeper/keeper.go b/x/basket/keeper/keeper.go index d63e275c9..e3c9a451a 100644 --- a/x/basket/keeper/keeper.go +++ b/x/basket/keeper/keeper.go @@ -4,7 +4,6 @@ import ( "github.com/KiraCore/sekai/x/basket/types" govkeeper "github.com/KiraCore/sekai/x/gov/keeper" govtypes "github.com/KiraCore/sekai/x/gov/types" - tokenskeeper "github.com/KiraCore/sekai/x/tokens/keeper" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -17,12 +16,12 @@ type Keeper struct { ak types.AccountKeeper bk types.BankKeeper gk govkeeper.Keeper - tk tokenskeeper.Keeper + tk types.TokensKeeper mk types.MultiStakingKeeper } // NewKeeper returns instance of a keeper -func NewKeeper(storeKey storetypes.StoreKey, cdc codec.BinaryCodec, ak types.AccountKeeper, bk types.BankKeeper, gk govkeeper.Keeper, tk tokenskeeper.Keeper, mk types.MultiStakingKeeper) Keeper { +func NewKeeper(storeKey storetypes.StoreKey, cdc codec.BinaryCodec, ak types.AccountKeeper, bk types.BankKeeper, gk govkeeper.Keeper, tk types.TokensKeeper, mk types.MultiStakingKeeper) Keeper { return Keeper{ cdc: cdc, storeKey: storeKey, diff --git a/x/basket/keeper/mint_burn_swap.go b/x/basket/keeper/mint_burn_swap.go index c0fd30c7b..3e211f5d8 100644 --- a/x/basket/keeper/mint_burn_swap.go +++ b/x/basket/keeper/mint_burn_swap.go @@ -59,7 +59,7 @@ func (k Keeper) MintBasketToken(ctx sdk.Context, msg *types.MsgBasketTokenMint) } basketCoins := sdk.Coins{basketCoin} - err = k.bk.MintCoins(ctx, types.ModuleName, basketCoins) + err = k.tk.MintCoins(ctx, types.ModuleName, basketCoins) if err != nil { return err } diff --git a/x/basket/types/expected_keepers.go b/x/basket/types/expected_keepers.go index 98ed046fb..389d633b9 100644 --- a/x/basket/types/expected_keepers.go +++ b/x/basket/types/expected_keepers.go @@ -3,6 +3,7 @@ package types import ( govtypes "github.com/KiraCore/sekai/x/gov/types" multistakingtypes "github.com/KiraCore/sekai/x/multistaking/types" + tokenstypes "github.com/KiraCore/sekai/x/tokens/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) @@ -35,3 +36,10 @@ type MultistakingHooks interface { AfterUpsertStakingPool(ctx sdk.Context, valAddr sdk.ValAddress, pool multistakingtypes.StakingPool) // Must be called when a upsert staking pool AfterSlashStakingPool(ctx sdk.Context, valAddr sdk.ValAddress, pool multistakingtypes.StakingPool, slash sdk.Dec) } + +// TokensKeeper defines expected interface needed from tokens keeper +type TokensKeeper interface { + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + GetTokenInfo(ctx sdk.Context, denom string) *tokenstypes.TokenInfo + GetAllTokenInfos(ctx sdk.Context) []tokenstypes.TokenInfo +} diff --git a/x/genutil/client/cli/init.go b/x/genutil/client/cli/init.go index 0823d5c9b..d48173a54 100644 --- a/x/genutil/client/cli/init.go +++ b/x/genutil/client/cli/init.go @@ -131,7 +131,7 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { } tokenGenState := tokenstypes.GetGenesisStateFromAppState(clientCtx.Codec, genesis) - tokenGenState.TokenInfos = []*tokenstypes.TokenInfo{ + tokenGenState.TokenInfos = []tokenstypes.TokenInfo{ { Denom: defaultDenom, FeeRate: sdk.OneDec(), diff --git a/x/gov/types/permission.pb.go b/x/gov/types/permission.pb.go index d1c6d8f46..4b8a63113 100644 --- a/x/gov/types/permission.pb.go +++ b/x/gov/types/permission.pb.go @@ -37,8 +37,6 @@ const ( // PERMISSION_VOTE_WHITELIST_ACCOUNT_PERMISSION_PROPOSAL defines the permission that an actor must have in order to vote a // Proposal to whitelist account permission. PermVoteWhitelistAccountPermissionProposal PermValue = 5 - // PERMISSION_UPSERT_TOKEN_ALIAS - PermUpsertTokenAlias PermValue = 6 // PERMISSION_CHANGE_TX_FEE PermChangeTxFee PermValue = 7 // PERMISSION_UPSERT_TOKEN_RATE @@ -54,10 +52,6 @@ const ( // PERMISSION_VOTE_SET_NETWORK_PROPERTY_PROPOSAL defines the permission that an actor must have in order to vote a // Proposal to set network property. PermVoteSetNetworkPropertyProposal PermValue = 13 - // PERMISSION_CREATE_UPSERT_TOKEN_ALIAS_PROPOSAL defines the permission needed to create proposals for upsert token Alias. - PermCreateUpsertTokenAliasProposal PermValue = 14 - // PERMISSION_VOTE_UPSERT_TOKEN_ALIAS_PROPOSAL defines the permission needed to vote proposals for upsert token. - PermVoteUpsertTokenAliasProposal PermValue = 15 // PERMISSION_CREATE_SET_POOR_NETWORK_MESSAGES defines the permission needed to create proposals for setting poor network messages PermCreateSetPoorNetworkMessagesProposal PermValue = 16 // PERMISSION_VOTE_SET_POOR_NETWORK_MESSAGES_PROPOSAL defines the permission needed to vote proposals to set poor network messages @@ -185,7 +179,6 @@ var PermValue_name = map[int32]string{ 3: "PERMISSION_CLAIM_COUNCILOR", 4: "PERMISSION_WHITELIST_ACCOUNT_PERMISSION_PROPOSAL", 5: "PERMISSION_VOTE_WHITELIST_ACCOUNT_PERMISSION_PROPOSAL", - 6: "PERMISSION_UPSERT_TOKEN_ALIAS", 7: "PERMISSION_CHANGE_TX_FEE", 8: "PERMISSION_UPSERT_TOKEN_RATE", 9: "PERMISSION_UPSERT_ROLE", @@ -193,8 +186,6 @@ var PermValue_name = map[int32]string{ 11: "PERMISSION_VOTE_UPSERT_DATA_REGISTRY_PROPOSAL", 12: "PERMISSION_CREATE_SET_NETWORK_PROPERTY_PROPOSAL", 13: "PERMISSION_VOTE_SET_NETWORK_PROPERTY_PROPOSAL", - 14: "PERMISSION_CREATE_UPSERT_TOKEN_ALIAS_PROPOSAL", - 15: "PERMISSION_VOTE_UPSERT_TOKEN_ALIAS_PROPOSAL", 16: "PERMISSION_CREATE_SET_POOR_NETWORK_MESSAGES", 17: "PERMISSION_VOTE_SET_POOR_NETWORK_MESSAGES_PROPOSAL", 18: "PERMISSION_CREATE_UPSERT_TOKEN_RATE_PROPOSAL", @@ -258,7 +249,6 @@ var PermValue_value = map[string]int32{ "PERMISSION_CLAIM_COUNCILOR": 3, "PERMISSION_WHITELIST_ACCOUNT_PERMISSION_PROPOSAL": 4, "PERMISSION_VOTE_WHITELIST_ACCOUNT_PERMISSION_PROPOSAL": 5, - "PERMISSION_UPSERT_TOKEN_ALIAS": 6, "PERMISSION_CHANGE_TX_FEE": 7, "PERMISSION_UPSERT_TOKEN_RATE": 8, "PERMISSION_UPSERT_ROLE": 9, @@ -266,8 +256,6 @@ var PermValue_value = map[string]int32{ "PERMISSION_VOTE_UPSERT_DATA_REGISTRY_PROPOSAL": 11, "PERMISSION_CREATE_SET_NETWORK_PROPERTY_PROPOSAL": 12, "PERMISSION_VOTE_SET_NETWORK_PROPERTY_PROPOSAL": 13, - "PERMISSION_CREATE_UPSERT_TOKEN_ALIAS_PROPOSAL": 14, - "PERMISSION_VOTE_UPSERT_TOKEN_ALIAS_PROPOSAL": 15, "PERMISSION_CREATE_SET_POOR_NETWORK_MESSAGES": 16, "PERMISSION_VOTE_SET_POOR_NETWORK_MESSAGES_PROPOSAL": 17, "PERMISSION_CREATE_UPSERT_TOKEN_RATE_PROPOSAL": 18, @@ -339,111 +327,108 @@ func init() { func init() { proto.RegisterFile("kira/gov/permission.proto", fileDescriptor_214168f8815c1062) } var fileDescriptor_214168f8815c1062 = []byte{ - // 1692 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x99, 0xdb, 0x76, 0xd3, 0x46, - 0x17, 0xc7, 0x93, 0xef, 0xa3, 0x14, 0xa6, 0x14, 0x5c, 0x43, 0x43, 0x18, 0x88, 0x33, 0x39, 0x9f, - 0xc0, 0x86, 0x04, 0xd2, 0x52, 0x5a, 0xa8, 0x6c, 0x8f, 0x63, 0x13, 0xdb, 0xf2, 0x92, 0xe4, 0x18, - 0xd2, 0xb2, 0x5c, 0xe1, 0x0c, 0x8e, 0x6a, 0xc5, 0x72, 0x25, 0x85, 0x43, 0x1f, 0xa0, 0xab, 0x4b, - 0x57, 0x7d, 0x01, 0x5d, 0xf5, 0x65, 0x7a, 0xc9, 0x65, 0x2f, 0xbb, 0xe0, 0x45, 0xba, 0x24, 0xdb, - 0x1a, 0x8d, 0x2c, 0xd9, 0x4a, 0xaf, 0x38, 0xd8, 0xf3, 0xfb, 0xef, 0xbd, 0x67, 0xef, 0x99, 0xbd, - 0xc7, 0xe0, 0x46, 0x47, 0xd1, 0xe5, 0x4c, 0x5b, 0x7b, 0x9d, 0xe9, 0x11, 0xfd, 0x44, 0x31, 0x0c, - 0x45, 0xeb, 0xa6, 0x7b, 0xba, 0x66, 0x6a, 0xc9, 0x0b, 0xce, 0x47, 0xe9, 0xb6, 0xf6, 0x1a, 0x5e, - 0x6b, 0x6b, 0x6d, 0xcd, 0xfd, 0xcf, 0x8c, 0xf3, 0xb7, 0xfe, 0xe7, 0x9b, 0xbf, 0xdd, 0x05, 0x17, - 0x6b, 0x44, 0x3f, 0x39, 0x90, 0xd5, 0x53, 0x92, 0x5c, 0x00, 0x57, 0x6a, 0x58, 0xa8, 0x94, 0x44, - 0xb1, 0xc4, 0x57, 0x9b, 0x87, 0x58, 0xe0, 0x13, 0x53, 0xf0, 0x92, 0x65, 0xa3, 0x0b, 0xce, 0x77, - 0x0e, 0x89, 0xae, 0x25, 0x77, 0x01, 0xf4, 0x7d, 0x45, 0xc4, 0x52, 0x93, 0xfe, 0x53, 0x4c, 0x4c, - 0xc3, 0x19, 0xcb, 0x46, 0x49, 0xe7, 0xdb, 0x22, 0x31, 0x6b, 0x9e, 0x35, 0x46, 0x60, 0x5d, 0xae, - 0xcc, 0x95, 0x2a, 0xcd, 0x03, 0xae, 0x5c, 0xca, 0x73, 0x12, 0x2f, 0x24, 0xfe, 0x47, 0xd7, 0xe5, - 0x54, 0x59, 0x71, 0xcc, 0x51, 0x8e, 0x64, 0x53, 0xd3, 0x43, 0xd7, 0xe5, 0xf8, 0x7a, 0x35, 0x57, - 0x2a, 0xf3, 0x42, 0xe2, 0xff, 0x81, 0x75, 0x39, 0xed, 0xb4, 0xdb, 0x52, 0x54, 0x4d, 0x4f, 0xfe, - 0x04, 0xee, 0xfa, 0xd6, 0x35, 0x8a, 0x25, 0x09, 0x97, 0x4b, 0xa2, 0xd4, 0xe4, 0x72, 0xce, 0x6a, - 0xbf, 0xd5, 0xcd, 0x9a, 0xc0, 0xd7, 0x78, 0x91, 0x2b, 0x27, 0xce, 0xc1, 0x4d, 0xcb, 0x46, 0xab, - 0x0e, 0xad, 0x71, 0xac, 0x98, 0x44, 0x55, 0x0c, 0x93, 0x6b, 0xb5, 0xb4, 0xd3, 0xae, 0xcf, 0x95, - 0x9a, 0xae, 0xf5, 0x34, 0x43, 0x56, 0x93, 0x0a, 0x78, 0xe0, 0x83, 0x1c, 0xf0, 0x12, 0x8e, 0x29, - 0xf3, 0x09, 0x4c, 0x5b, 0x36, 0xda, 0x74, 0xc3, 0xae, 0x99, 0x24, 0x86, 0xd4, 0x23, 0x30, 0xe7, - 0x03, 0xd5, 0x6b, 0x22, 0x16, 0x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 0xf2, 0xd7, - 0x87, 0xd4, 0xf4, 0xfb, 0x0f, 0xa9, 0xe9, 0x7f, 0x3e, 0xa4, 0xa6, 0xff, 0xf8, 0x98, 0x9a, 0x7a, - 0xff, 0x31, 0x35, 0xf5, 0xf7, 0xc7, 0xd4, 0xd4, 0xe1, 0x4a, 0x5b, 0x31, 0x8f, 0x4f, 0x5f, 0xa6, - 0x5b, 0xda, 0x49, 0x66, 0x5f, 0xd1, 0xe5, 0x9c, 0xa6, 0x93, 0x8c, 0x41, 0x3a, 0xb2, 0x92, 0x79, - 0xeb, 0xfe, 0xe8, 0x60, 0xbe, 0xeb, 0x11, 0xe3, 0xe5, 0x79, 0xf7, 0x07, 0x85, 0x9d, 0x7f, 0x03, - 0x00, 0x00, 0xff, 0xff, 0x97, 0x58, 0x79, 0x11, 0x8d, 0x18, 0x00, 0x00, + // 1647 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x98, 0x5b, 0x77, 0xd3, 0xc6, + 0x16, 0xc7, 0x93, 0x73, 0x38, 0xe7, 0xc0, 0x1c, 0x5a, 0x5c, 0x43, 0x03, 0x0c, 0xe0, 0x4c, 0xee, + 0x37, 0xb0, 0x21, 0x81, 0xb4, 0x94, 0x16, 0x2a, 0xdb, 0xe3, 0xd8, 0xc4, 0xb6, 0xbc, 0x24, 0x39, + 0x86, 0xb4, 0x2c, 0x57, 0x38, 0x83, 0xa3, 0xda, 0xf1, 0xb8, 0x92, 0xc2, 0xa5, 0x9f, 0xa0, 0x4b, + 0x4f, 0x7d, 0xeb, 0x93, 0x9e, 0xfa, 0x65, 0xfa, 0xc8, 0x63, 0x1f, 0xbb, 0xe0, 0x8b, 0x74, 0x49, + 0xb6, 0x35, 0x1a, 0x59, 0xb2, 0x95, 0x3e, 0xe5, 0x62, 0xcf, 0xef, 0xbf, 0xf7, 0x9e, 0xbd, 0x67, + 0xf6, 0x1e, 0x70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38, 0x07, 0x37, 0x2d, 0x1b, 0xad, 0x3a, + 0xb4, 0xc6, 0xb1, 0x66, 0x92, 0xae, 0x66, 0x98, 0x42, 0xab, 0x45, 0x4f, 0x7b, 0x3e, 0x57, 0x6a, + 0x3a, 0xed, 0x53, 0x43, 0xed, 0x26, 0x35, 0xf0, 0xc0, 0x07, 0x39, 0x10, 0x15, 0x1c, 0x53, 0xe6, + 0x3f, 0x30, 0x6d, 0xd9, 0x68, 0xd3, 0x0d, 0x3b, 0x35, 0x49, 0x0c, 0xa9, 0x7b, 0xe0, 0x9a, 0x3f, + 0x08, 0x45, 0xa1, 0xba, 0x87, 0x9b, 0xca, 0xb3, 0x66, 0x01, 0xe3, 0xc4, 0xff, 0xe0, 0x65, 0xcb, + 0x46, 0x97, 0xdc, 0x10, 0x1c, 0xab, 0xbd, 0x36, 0x51, 0xde, 0x16, 0x08, 0x49, 0x3e, 0x04, 0x37, + 0x7d, 0x4b, 0xea, 0x35, 0x19, 0x4b, 0x4a, 0x53, 0x11, 0xf7, 0x71, 0xb5, 0x29, 0x09, 0x0a, 0x4e, + 0x9c, 0x87, 0x57, 0x2d, 0x1b, 0x5d, 0x76, 0x96, 0xd5, 0xfb, 0x06, 0xd1, 0x4d, 0x85, 0x76, 0x48, + 0xaf, 0xd4, 0x7b, 0x45, 0x93, 0x69, 0x30, 0x37, 0xbe, 0x54, 0x12, 0xcb, 0x38, 0x71, 0x01, 0x26, + 0x2d, 0x1b, 0x7d, 0xca, 0x16, 0x49, 0xb4, 0x4b, 0x92, 0x2f, 0x40, 0xc6, 0x6f, 0x9d, 0x84, 0x05, + 0x05, 0x8f, 0x96, 0xe5, 0x05, 0x45, 0x68, 0x4a, 0x78, 0xaf, 0x24, 0x2b, 0xd2, 0x73, 0x16, 0x02, + 0x00, 0xd7, 0x2d, 0x1b, 0x2d, 0xbb, 0x46, 0xeb, 0x44, 0x35, 0xc9, 0x00, 0x97, 0x57, 0x4d, 0x55, + 0x22, 0x6d, 0xcd, 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0xa4, 0x7e, 0x1e, 0xb0, 0x35, 0x82, + 0x59, 0x00, 0xab, 0xe3, 0xb6, 0x0e, 0x7f, 0x38, 0x75, 0xcc, 0x80, 0x73, 0x10, 0x5a, 0x36, 0x9a, + 0x63, 0x66, 0x3a, 0x05, 0xed, 0x71, 0x8a, 0x60, 0x39, 0x68, 0x5b, 0x28, 0xe5, 0x2a, 0x4c, 0x59, + 0x36, 0x82, 0x23, 0xb3, 0x42, 0x48, 0xaf, 0xc0, 0xfd, 0x71, 0x8b, 0xdc, 0xdd, 0x90, 0x07, 0x87, + 0x66, 0x33, 0x5b, 0x16, 0x72, 0xfb, 0xa3, 0xa3, 0xcd, 0x23, 0x5f, 0x0b, 0xe6, 0xad, 0xbb, 0x31, + 0x86, 0x7b, 0x64, 0x66, 0xbb, 0x6a, 0xab, 0x33, 0x38, 0xf2, 0x26, 0xe5, 0x6d, 0x0c, 0x95, 0xeb, + 0x7c, 0xde, 0x4e, 0xd1, 0x38, 0xe6, 0xce, 0xfd, 0x51, 0x40, 0xb0, 0x53, 0x1f, 0x8d, 0xa2, 0x13, + 0x17, 0xb6, 0x71, 0x92, 0x50, 0xdd, 0x67, 0x32, 0x10, 0xde, 0xb1, 0x6c, 0xb4, 0xe1, 0x0b, 0x36, + 0x31, 0x88, 0xd9, 0x38, 0xa6, 0x5d, 0xe2, 0xed, 0xa1, 0xa4, 0xf6, 0x3a, 0x9e, 0xd2, 0x11, 0xd8, + 0x09, 0x7a, 0x13, 0x47, 0xe7, 0x06, 0xdc, 0xb2, 0x6c, 0xb4, 0x36, 0x72, 0x67, 0x9a, 0x4a, 0x68, + 0x66, 0xcb, 0x62, 0x41, 0x69, 0x08, 0x92, 0x53, 0x39, 0x7b, 0x92, 0x90, 0xf7, 0x05, 0xeb, 0x66, + 0x30, 0xb3, 0x65, 0xfa, 0xca, 0x7c, 0xa3, 0xea, 0xa4, 0xde, 0x6f, 0xeb, 0xea, 0x11, 0x8b, 0x53, + 0x85, 0xcb, 0x9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 0x58, 0x78, 0xee, 0x97, 0xdf, 0x53, 0x33, + 0xd9, 0x27, 0x7f, 0x7c, 0x48, 0xcd, 0xbe, 0xff, 0x90, 0x9a, 0xfd, 0xeb, 0x43, 0x6a, 0xf6, 0xd7, + 0x8f, 0xa9, 0x99, 0xf7, 0x1f, 0x53, 0x33, 0x7f, 0x7e, 0x4c, 0xcd, 0x1c, 0xae, 0xb4, 0x35, 0xf3, + 0xf8, 0xf4, 0x65, 0xba, 0x45, 0x4f, 0x32, 0xfb, 0x9a, 0xae, 0xe6, 0xa8, 0x4e, 0x32, 0x06, 0xe9, + 0xa8, 0x5a, 0xe6, 0xad, 0xfb, 0x0a, 0x6f, 0xbe, 0xeb, 0x13, 0xe3, 0xe5, 0x7f, 0xdd, 0x17, 0xf6, + 0x9d, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x90, 0x74, 0x83, 0x9e, 0x17, 0x00, 0x00, } diff --git a/x/layer2/keeper/abci.go b/x/layer2/keeper/abci.go index ac5a7224a..7bb672699 100644 --- a/x/layer2/keeper/abci.go +++ b/x/layer2/keeper/abci.go @@ -127,7 +127,7 @@ func (k Keeper) FinishDappBootstrap(ctx sdk.Context, dapp types.Dapp) { drip = 1 } rate := sdk.NewDecFromInt(spendingPoolDeposit).Quo(sdk.NewDec(int64(drip))) - err = k.bk.MintCoins(ctx, types.ModuleName, sdk.Coins{sdk.NewCoin(dappBondLpToken, totalSupply)}) + err = k.tk.MintCoins(ctx, types.ModuleName, sdk.Coins{sdk.NewCoin(dappBondLpToken, totalSupply)}) if err != nil { panic(err) } diff --git a/x/layer2/keeper/keeper.go b/x/layer2/keeper/keeper.go index 935541102..582d3b003 100644 --- a/x/layer2/keeper/keeper.go +++ b/x/layer2/keeper/keeper.go @@ -17,9 +17,16 @@ type Keeper struct { sk types.StakingKeeper gk govkeeper.Keeper spk types.SpendingKeeper + tk types.TokensKeeper } -func NewKeeper(storeKey storetypes.StoreKey, cdc codec.BinaryCodec, bk types.BankKeeper, sk types.StakingKeeper, gk govkeeper.Keeper, spk types.SpendingKeeper) Keeper { +func NewKeeper(storeKey storetypes.StoreKey, cdc codec.BinaryCodec, + bk types.BankKeeper, + sk types.StakingKeeper, + gk govkeeper.Keeper, + spk types.SpendingKeeper, + tk types.TokensKeeper, +) Keeper { return Keeper{ cdc: cdc, storeKey: storeKey, diff --git a/x/layer2/keeper/msg_server.go b/x/layer2/keeper/msg_server.go index 036e26a66..a186cd6db 100644 --- a/x/layer2/keeper/msg_server.go +++ b/x/layer2/keeper/msg_server.go @@ -795,7 +795,7 @@ func (k msgServer) MintIssueTx(goCtx context.Context, msg *types.MsgMintIssueTx) } mintCoin := sdk.NewCoin(msg.Denom, msg.Amount) - err := k.keeper.bk.MintCoins(ctx, types.ModuleName, sdk.Coins{mintCoin}) + err := k.keeper.tk.MintCoins(ctx, types.ModuleName, sdk.Coins{mintCoin}) if err != nil { return nil, err } diff --git a/x/layer2/types/expected_keepers.go b/x/layer2/types/expected_keepers.go index bfba900d8..960e83598 100644 --- a/x/layer2/types/expected_keepers.go +++ b/x/layer2/types/expected_keepers.go @@ -4,6 +4,7 @@ import ( govtypes "github.com/KiraCore/sekai/x/gov/types" spendingtypes "github.com/KiraCore/sekai/x/spending/types" stakingtypes "github.com/KiraCore/sekai/x/staking/types" + tokenstypes "github.com/KiraCore/sekai/x/tokens/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -29,3 +30,9 @@ type SpendingKeeper interface { CreateSpendingPool(ctx sdk.Context, pool spendingtypes.SpendingPool) error DepositSpendingPoolFromModule(ctx sdk.Context, moduleName, poolName string, amount sdk.Coins) error } + +// TokensKeeper defines expected interface needed from tokens keeper +type TokensKeeper interface { + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + GetTokenInfo(ctx sdk.Context, denom string) *tokenstypes.TokenInfo +} diff --git a/x/multistaking/keeper/delegation.go b/x/multistaking/keeper/delegation.go index a9883ac7d..4e41d268e 100644 --- a/x/multistaking/keeper/delegation.go +++ b/x/multistaking/keeper/delegation.go @@ -334,7 +334,7 @@ func (k Keeper) Delegate(ctx sdk.Context, msg *types.MsgDelegate) error { pool.TotalShareTokens = sdk.Coins(pool.TotalShareTokens).Add(poolCoins...) k.SetStakingPool(ctx, pool) - err = k.bankKeeper.MintCoins(ctx, minttypes.ModuleName, poolCoins) + err = k.tokenKeeper.MintCoins(ctx, minttypes.ModuleName, poolCoins) if err != nil { return err } diff --git a/x/multistaking/types/expected_keepers.go b/x/multistaking/types/expected_keepers.go index f7bc5ab7f..a517871d5 100644 --- a/x/multistaking/types/expected_keepers.go +++ b/x/multistaking/types/expected_keepers.go @@ -32,7 +32,8 @@ type BankKeeper interface { SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error } -// TokensKeeper defines expected interface needed to get token rate +// TokensKeeper defines expected interface needed from tokens keeper type TokensKeeper interface { + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error GetTokenInfo(ctx sdk.Context, denom string) *tokenstypes.TokenInfo } diff --git a/x/recovery/keeper/keeper.go b/x/recovery/keeper/keeper.go index 8fa2c2092..de2b1b9cd 100644 --- a/x/recovery/keeper/keeper.go +++ b/x/recovery/keeper/keeper.go @@ -23,6 +23,7 @@ type Keeper struct { ck types.CollectivesKeeper spk types.SpendingKeeper custodyk types.CustodyKeeper + tk types.TokensKeeper } // NewKeeper creates a recovery keeper @@ -35,6 +36,7 @@ func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, ck types.CollectivesKeeper, spk types.SpendingKeeper, custodyk types.CustodyKeeper, + tk types.TokensKeeper, ) Keeper { return Keeper{ @@ -48,6 +50,7 @@ func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, ck: ck, spk: spk, custodyk: custodyk, + tk: tk, } } diff --git a/x/recovery/keeper/msg_server.go b/x/recovery/keeper/msg_server.go index 9dc0d4b34..7d48a6b2a 100644 --- a/x/recovery/keeper/msg_server.go +++ b/x/recovery/keeper/msg_server.go @@ -550,7 +550,7 @@ func (k msgServer) IssueRecoveryTokens(goCtx context.Context, msg *types.MsgIssu // issue 10'000'000 tokens recoveryTokenAmount := sdk.NewInt(10_000_000).Mul(sdk.NewInt(1000_000)) recoveryCoins := sdk.NewCoins(sdk.NewCoin(denom, recoveryTokenAmount)) - err = k.bk.MintCoins(ctx, types.ModuleName, recoveryCoins) + err = k.tk.MintCoins(ctx, types.ModuleName, recoveryCoins) if err != nil { return nil, err } diff --git a/x/recovery/types/expected_keepers.go b/x/recovery/types/expected_keepers.go index eb8b01d2c..8929c685f 100644 --- a/x/recovery/types/expected_keepers.go +++ b/x/recovery/types/expected_keepers.go @@ -7,6 +7,7 @@ import ( multistakingtypes "github.com/KiraCore/sekai/x/multistaking/types" spendingtypes "github.com/KiraCore/sekai/x/spending/types" stakingtypes "github.com/KiraCore/sekai/x/staking/types" + tokenstypes "github.com/KiraCore/sekai/x/tokens/types" sdk "github.com/cosmos/cosmos-sdk/types" auth "github.com/cosmos/cosmos-sdk/x/auth/types" ) @@ -127,3 +128,9 @@ type CustodyKeeper interface { GetCustodyPoolByAddress(ctx sdk.Context, address sdk.AccAddress) *custodytypes.TransactionPool DropCustodyPool(ctx sdk.Context, addr sdk.AccAddress) } + +// TokensKeeper defines expected interface needed from tokens keeper +type TokensKeeper interface { + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + GetTokenInfo(ctx sdk.Context, denom string) *tokenstypes.TokenInfo +} diff --git a/x/tokens/handler_test.go b/x/tokens/handler_test.go index 0fd4c89c8..4df3a8429 100644 --- a/x/tokens/handler_test.go +++ b/x/tokens/handler_test.go @@ -159,7 +159,7 @@ func TestNewHandler_MsgUpsertTokenInfo(t *testing.T) { ratesAll := app.TokensKeeper.GetAllTokenInfos(ctx) require.True(t, len(ratesAll) > 0) ratesByDenom := app.TokensKeeper.GetTokenInfosByDenom(ctx, []string{theMsg.Denom}) - require.True(t, ratesByDenom[theMsg.Denom] != nil) + require.True(t, ratesByDenom[theMsg.Denom].Data != nil) } } } diff --git a/x/tokens/keeper/freeze.go b/x/tokens/keeper/freeze.go index 0e543413d..4565d8014 100644 --- a/x/tokens/keeper/freeze.go +++ b/x/tokens/keeper/freeze.go @@ -7,50 +7,42 @@ import ( func (k Keeper) AddTokensToBlacklist(ctx sdk.Context, tokens []string) { tokensBlackWhites := k.GetTokenBlackWhites(ctx) - if tokensBlackWhites != nil { - tokensBlackWhites.Blacklisted = addTokens(tokensBlackWhites.Blacklisted, tokens) - k.SetTokenBlackWhites(ctx, tokensBlackWhites) - } + tokensBlackWhites.Blacklisted = addTokens(tokensBlackWhites.Blacklisted, tokens) + k.SetTokenBlackWhites(ctx, tokensBlackWhites) } func (k Keeper) RemoveTokensFromBlacklist(ctx sdk.Context, tokens []string) { tokensBlackWhites := k.GetTokenBlackWhites(ctx) - if tokensBlackWhites != nil { - tokensBlackWhites.Blacklisted = removeTokens(tokensBlackWhites.Blacklisted, tokens) - k.SetTokenBlackWhites(ctx, tokensBlackWhites) - } + tokensBlackWhites.Blacklisted = removeTokens(tokensBlackWhites.Blacklisted, tokens) + k.SetTokenBlackWhites(ctx, tokensBlackWhites) } func (k Keeper) AddTokensToWhitelist(ctx sdk.Context, tokens []string) { tokensBlackWhites := k.GetTokenBlackWhites(ctx) - if tokensBlackWhites != nil { - tokensBlackWhites.Whitelisted = addTokens(tokensBlackWhites.Whitelisted, tokens) - k.SetTokenBlackWhites(ctx, tokensBlackWhites) - } + tokensBlackWhites.Whitelisted = addTokens(tokensBlackWhites.Whitelisted, tokens) + k.SetTokenBlackWhites(ctx, tokensBlackWhites) } func (k Keeper) RemoveTokensFromWhitelist(ctx sdk.Context, tokens []string) { tokensBlackWhites := k.GetTokenBlackWhites(ctx) - if tokensBlackWhites != nil { - tokensBlackWhites.Whitelisted = removeTokens(tokensBlackWhites.Whitelisted, tokens) - k.SetTokenBlackWhites(ctx, tokensBlackWhites) - } + tokensBlackWhites.Whitelisted = removeTokens(tokensBlackWhites.Whitelisted, tokens) + k.SetTokenBlackWhites(ctx, tokensBlackWhites) } -func (k Keeper) SetTokenBlackWhites(ctx sdk.Context, tokensBlackWhite *types.TokensWhiteBlack) { +func (k Keeper) SetTokenBlackWhites(ctx sdk.Context, tokensBlackWhite types.TokensWhiteBlack) { store := ctx.KVStore(k.storeKey) - store.Set(PrefixKeyTokenBlackWhite, k.cdc.MustMarshal(tokensBlackWhite)) + store.Set(PrefixKeyTokenBlackWhite, k.cdc.MustMarshal(&tokensBlackWhite)) } -func (k Keeper) GetTokenBlackWhites(ctx sdk.Context) *types.TokensWhiteBlack { +func (k Keeper) GetTokenBlackWhites(ctx sdk.Context) types.TokensWhiteBlack { store := ctx.KVStore(k.storeKey) bz := store.Get(PrefixKeyTokenBlackWhite) if bz == nil { - return nil + return types.TokensWhiteBlack{} } - tokensBlackWhite := new(types.TokensWhiteBlack) - k.cdc.MustUnmarshal(bz, tokensBlackWhite) + tokensBlackWhite := types.TokensWhiteBlack{} + k.cdc.MustUnmarshal(bz, &tokensBlackWhite) return tokensBlackWhite } diff --git a/x/tokens/keeper/freeze_test.go b/x/tokens/keeper/freeze_test.go index 43e21ea2c..95cf73e62 100644 --- a/x/tokens/keeper/freeze_test.go +++ b/x/tokens/keeper/freeze_test.go @@ -87,8 +87,8 @@ func (suite *KeeperTestSuite) TestTokenBlackWhiteSetGet() { Whitelisted: []string{"newwhite"}, Blacklisted: []string{"newblack"}, } - suite.app.TokensKeeper.SetTokenBlackWhites(ctx, &blackWhites) + suite.app.TokensKeeper.SetTokenBlackWhites(ctx, blackWhites) bw := suite.app.TokensKeeper.GetTokenBlackWhites(ctx) suite.Require().NotNil(bw) - suite.Require().Equal(blackWhites, *bw) + suite.Require().Equal(blackWhites, bw) } diff --git a/x/tokens/keeper/grpc_query.go b/x/tokens/keeper/grpc_query.go index 96c73abae..a1aa9220d 100644 --- a/x/tokens/keeper/grpc_query.go +++ b/x/tokens/keeper/grpc_query.go @@ -17,23 +17,33 @@ func NewQuerier(keeper Keeper) types.QueryServer { var _ types.QueryServer = Querier{} -func (q Querier) GetTokenInfo(ctx context.Context, request *types.TokenInfoRequest) (*types.TokenInfoResponse, error) { - rate := q.keeper.GetTokenInfo(sdk.UnwrapSDKContext(ctx), request.Denom) - - if rate == nil { - return &types.TokenInfoResponse{Data: nil}, nil - } - return &types.TokenInfoResponse{Data: rate}, nil +func (q Querier) GetTokenInfo(goCtx context.Context, request *types.TokenInfoRequest) (*types.TokenInfoResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + info := q.keeper.GetTokenInfo(ctx, request.Denom) + supply := q.keeper.bankKeeper.GetSupply(ctx, request.Denom) + return &types.TokenInfoResponse{ + Data: info, + Supply: supply, + }, nil } func (q Querier) GetTokenInfosByDenom(ctx context.Context, request *types.TokenInfosByDenomRequest) (*types.TokenInfosByDenomResponse, error) { - rates := q.keeper.GetTokenInfosByDenom(sdk.UnwrapSDKContext(ctx), request.Denoms) - return &types.TokenInfosByDenomResponse{Data: rates}, nil + infos := q.keeper.GetTokenInfosByDenom(sdk.UnwrapSDKContext(ctx), request.Denoms) + return &types.TokenInfosByDenomResponse{Data: infos}, nil } -func (q Querier) GetAllTokenInfos(ctx context.Context, request *types.AllTokenInfosRequest) (*types.AllTokenInfosResponse, error) { - rates := q.keeper.GetAllTokenInfos(sdk.UnwrapSDKContext(ctx)) - return &types.AllTokenInfosResponse{Data: rates}, nil +func (q Querier) GetAllTokenInfos(goCtx context.Context, request *types.AllTokenInfosRequest) (*types.AllTokenInfosResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + infos := q.keeper.GetAllTokenInfos(ctx) + data := []types.TokenInfoResponse{} + for _, info := range infos { + supply := q.keeper.bankKeeper.GetSupply(ctx, info.Denom) + data = append(data, types.TokenInfoResponse{ + Data: &info, + Supply: supply, + }) + } + return &types.AllTokenInfosResponse{Data: data}, nil } func (q Querier) GetTokenBlackWhites(ctx context.Context, request *types.TokenBlackWhitesRequest) (*types.TokenBlackWhitesResponse, error) { diff --git a/x/tokens/keeper/grpc_query_test.go b/x/tokens/keeper/grpc_query_test.go index 3719de29d..fbdec308b 100644 --- a/x/tokens/keeper/grpc_query_test.go +++ b/x/tokens/keeper/grpc_query_test.go @@ -39,9 +39,9 @@ func TestQuerier_GetTokenInfosByDenom(t *testing.T) { ) require.NoError(t, err) require.Equal(t, len(resp.Data), 1) - require.Equal(t, "ukex", resp.Data["ukex"].Denom) - require.Equal(t, sdk.NewDec(1), resp.Data["ukex"].FeeRate) - require.Equal(t, true, resp.Data["ukex"].FeePayments) + require.Equal(t, "ukex", resp.Data["ukex"].Data.Denom) + require.Equal(t, sdk.NewDec(1), resp.Data["ukex"].Data.FeeRate) + require.Equal(t, true, resp.Data["ukex"].Data.FeePayments) } func TestQuerier_GetAllTokenInfos(t *testing.T) { @@ -56,9 +56,9 @@ func TestQuerier_GetAllTokenInfos(t *testing.T) { ) require.NoError(t, err) require.Equal(t, len(resp.Data), 4) - require.Equal(t, "frozen", resp.Data[0].Denom) - require.Equal(t, sdk.NewDecWithPrec(1, 1), resp.Data[0].FeeRate) - require.Equal(t, true, resp.Data[0].FeePayments) + require.Equal(t, "xeth", resp.Data[0].Data.Denom) + require.Equal(t, sdk.NewDecWithPrec(1, 1), resp.Data[0].Data.FeeRate) + require.Equal(t, true, resp.Data[0].Data.FeePayments) } func TestQuerier_GetTokenBlackWhites(t *testing.T) { diff --git a/x/tokens/keeper/mint.go b/x/tokens/keeper/mint.go new file mode 100644 index 000000000..85cefb451 --- /dev/null +++ b/x/tokens/keeper/mint.go @@ -0,0 +1,29 @@ +package keeper + +import ( + "cosmossdk.io/math" + "github.com/KiraCore/sekai/x/tokens/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k Keeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { + for _, coin := range amt { + tokenInfo := k.GetTokenInfo(ctx, coin.Denom) + if tokenInfo == nil { + k.UpsertTokenInfo(ctx, types.TokenInfo{ + Denom: coin.Denom, + FeeRate: math.LegacyZeroDec(), + FeePayments: false, + StakeCap: math.LegacyZeroDec(), + StakeMin: math.OneInt(), + StakeToken: false, + Invalidated: false, + Symbol: coin.Denom, + Name: coin.Denom, + Icon: "", + Decimals: 6, + }) + } + } + return k.bankKeeper.MintCoins(ctx, moduleName, amt) +} diff --git a/x/tokens/keeper/msg_server.go b/x/tokens/keeper/msg_server.go index 48a85728c..022b136ac 100644 --- a/x/tokens/keeper/msg_server.go +++ b/x/tokens/keeper/msg_server.go @@ -42,7 +42,7 @@ func (k msgServer) UpsertTokenInfo(goCtx context.Context, msg *types.MsgUpsertTo return nil, errorsmod.Wrap(govtypes.ErrNotEnoughPermissions, govtypes.PermUpsertTokenInfo.String()) } - err = k.keeper.UpsertTokenInfo(ctx, *types.NewTokenInfo( + err = k.keeper.UpsertTokenInfo(ctx, types.NewTokenInfo( msg.Denom, msg.Rate, msg.FeePayments, diff --git a/x/tokens/keeper/token_info.go b/x/tokens/keeper/token_info.go index cfb6d4328..4e0badf43 100644 --- a/x/tokens/keeper/token_info.go +++ b/x/tokens/keeper/token_info.go @@ -3,7 +3,6 @@ package keeper import ( "errors" "fmt" - "strings" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" @@ -26,8 +25,8 @@ func (k Keeper) GetTokenInfo(ctx sdk.Context, denom string) *types.TokenInfo { } // GetAllTokenInfos returns all list of token rate -func (k Keeper) GetAllTokenInfos(ctx sdk.Context) []*types.TokenInfo { - var tokenRates []*types.TokenInfo +func (k Keeper) GetAllTokenInfos(ctx sdk.Context) []types.TokenInfo { + var tokenRates []types.TokenInfo // get iterator for token rates store := ctx.KVStore(k.storeKey) @@ -35,27 +34,23 @@ func (k Keeper) GetAllTokenInfos(ctx sdk.Context) []*types.TokenInfo { defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - denom := strings.TrimPrefix(string(iterator.Key()), string(PrefixKeyTokenInfo)) - tokenRate := k.GetTokenInfo(ctx, denom) - if tokenRate != nil { - tokenRates = append(tokenRates, tokenRate) - } + info := types.TokenInfo{} + k.cdc.MustUnmarshal(iterator.Value(), &info) + tokenRates = append(tokenRates, info) } return tokenRates } // GetTokenInfosByDenom returns all list of token rate -func (k Keeper) GetTokenInfosByDenom(ctx sdk.Context, denoms []string) map[string]*types.TokenInfo { - // get iterator for token aliases - store := ctx.KVStore(k.storeKey) - tokenRatesMap := make(map[string]*types.TokenInfo) +func (k Keeper) GetTokenInfosByDenom(ctx sdk.Context, denoms []string) map[string]types.TokenInfoResponse { + tokenRatesMap := make(map[string]types.TokenInfoResponse) for _, denom := range denoms { - denomTokenStoreID := append([]byte(PrefixKeyTokenInfo), []byte(denom)...) - - if store.Has(denomTokenStoreID) { - tokenRate := k.GetTokenInfo(ctx, denom) - tokenRatesMap[denom] = tokenRate + tokenRate := k.GetTokenInfo(ctx, denom) + supply := k.bankKeeper.GetSupply(ctx, denom) + tokenRatesMap[denom] = types.TokenInfoResponse{ + Data: tokenRate, + Supply: supply, } } return tokenRatesMap diff --git a/x/tokens/keeper/token_info_test.go b/x/tokens/keeper/token_info_test.go index a95b0bf1b..321e6925d 100644 --- a/x/tokens/keeper/token_info_test.go +++ b/x/tokens/keeper/token_info_test.go @@ -15,8 +15,8 @@ func (suite *KeeperTestSuite) TestTokenInfos() { rates := suite.app.TokensKeeper.GetAllTokenInfos(ctx) suite.Require().Len(rates, 4) rateMap := suite.app.TokensKeeper.GetTokenInfosByDenom(ctx, []string{"stake"}) - suite.Require().Equal(len(rateMap), 0) - suite.Require().Nil(rateMap["stake"]) + suite.Require().Equal(len(rateMap), 1) + suite.Require().Nil(rateMap["stake"].Data) // upsert token rate and check newRate := types.TokenInfo{ @@ -40,6 +40,6 @@ func (suite *KeeperTestSuite) TestTokenInfos() { rates = suite.app.TokensKeeper.GetAllTokenInfos(ctx) suite.Require().Len(rates, 4) rateMap = suite.app.TokensKeeper.GetTokenInfosByDenom(ctx, []string{"stake"}) - suite.Require().Equal(len(rateMap), 0) - suite.Require().Nil(rateMap["stake"]) + suite.Require().Equal(len(rateMap), 1) + suite.Require().Nil(rateMap["stake"].Data) } diff --git a/x/tokens/module.go b/x/tokens/module.go index 9d3d84af0..8120e5885 100644 --- a/x/tokens/module.go +++ b/x/tokens/module.go @@ -96,7 +96,7 @@ func (am AppModule) InitGenesis( cdc.MustUnmarshalJSON(data, &genesisState) for _, rate := range genesisState.TokenInfos { - am.tokensKeeper.UpsertTokenInfo(ctx, *rate) + am.tokensKeeper.UpsertTokenInfo(ctx, rate) } am.tokensKeeper.SetTokenBlackWhites(ctx, genesisState.TokenBlackWhites) diff --git a/x/tokens/proposal_handler.go b/x/tokens/proposal_handler.go index 3a78550a4..ba3641396 100644 --- a/x/tokens/proposal_handler.go +++ b/x/tokens/proposal_handler.go @@ -27,7 +27,7 @@ func (a ApplyUpsertTokenInfosProposalHandler) Apply(ctx sdk.Context, proposalID p.Denom, p.Rate, p.FeePayments, p.StakeCap, p.StakeMin, p.StakeToken, p.Invalidated, p.Symbol, p.Name, p.Icon, p.Decimals, ) - return a.keeper.UpsertTokenInfo(ctx, *rate) + return a.keeper.UpsertTokenInfo(ctx, rate) } type ApplyWhiteBlackChangeProposalHandler struct { diff --git a/x/tokens/types/expected_keepers.go b/x/tokens/types/expected_keepers.go index 760cbe04c..8e1229801 100644 --- a/x/tokens/types/expected_keepers.go +++ b/x/tokens/types/expected_keepers.go @@ -12,6 +12,8 @@ type CustomGovKeeper interface { // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { + GetSupply(ctx sdk.Context, denom string) sdk.Coin + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error SendCoins(ctx sdk.Context, senderAddr sdk.AccAddress, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error diff --git a/x/tokens/types/genesis.go b/x/tokens/types/genesis.go index 9c40adda6..0fefe2efd 100644 --- a/x/tokens/types/genesis.go +++ b/x/tokens/types/genesis.go @@ -10,13 +10,13 @@ import ( // DefaultGenesis returns the default CustomGo genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - TokenInfos: []*TokenInfo{ + TokenInfos: []TokenInfo{ NewTokenInfo("ukex", sdk.NewDec(1), true, sdk.NewDecWithPrec(50, 2), sdk.OneInt(), true, false, "KEX", "KEX", "", 6), // 1 NewTokenInfo("ubtc", sdk.NewDec(10), true, sdk.NewDecWithPrec(25, 2), sdk.OneInt(), true, false, "BTC", "Bitcoin", "", 9), // 10 NewTokenInfo("xeth", sdk.NewDecWithPrec(1, 1), true, sdk.NewDecWithPrec(10, 2), sdk.OneInt(), false, false, "ETH", "Ethereum", "", 18), // 0.1 NewTokenInfo("frozen", sdk.NewDecWithPrec(1, 1), true, sdk.ZeroDec(), sdk.OneInt(), false, false, "FROZEN", "FROZEN", "", 6), // 0.1 }, - TokenBlackWhites: &TokensWhiteBlack{ + TokenBlackWhites: TokensWhiteBlack{ Whitelisted: []string{"ukex"}, Blacklisted: []string{"frozen"}, }, diff --git a/x/tokens/types/genesis.pb.go b/x/tokens/types/genesis.pb.go index e34fbedce..8145be4e5 100644 --- a/x/tokens/types/genesis.pb.go +++ b/x/tokens/types/genesis.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" math "math" @@ -23,8 +24,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type GenesisState struct { - TokenInfos []*TokenInfo `protobuf:"bytes,1,rep,name=tokenInfos,proto3" json:"tokenInfos,omitempty"` - TokenBlackWhites *TokensWhiteBlack `protobuf:"bytes,2,opt,name=tokenBlackWhites,proto3" json:"tokenBlackWhites,omitempty"` + TokenInfos []TokenInfo `protobuf:"bytes,1,rep,name=tokenInfos,proto3" json:"tokenInfos"` + TokenBlackWhites TokensWhiteBlack `protobuf:"bytes,2,opt,name=tokenBlackWhites,proto3" json:"tokenBlackWhites"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -60,18 +61,18 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetTokenInfos() []*TokenInfo { +func (m *GenesisState) GetTokenInfos() []TokenInfo { if m != nil { return m.TokenInfos } return nil } -func (m *GenesisState) GetTokenBlackWhites() *TokensWhiteBlack { +func (m *GenesisState) GetTokenBlackWhites() TokensWhiteBlack { if m != nil { return m.TokenBlackWhites } - return nil + return TokensWhiteBlack{} } func init() { @@ -81,21 +82,23 @@ func init() { func init() { proto.RegisterFile("kira/tokens/genesis.proto", fileDescriptor_d3cbd9121e22d5d1) } var fileDescriptor_d3cbd9121e22d5d1 = []byte{ - // 223 bytes of a gzipped FileDescriptorProto + // 242 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xce, 0x2c, 0x4a, 0xd4, 0x2f, 0xc9, 0xcf, 0x4e, 0xcd, 0x2b, 0xd6, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x06, 0x49, 0xe9, 0x41, 0xa4, 0xa4, 0xc4, 0x91, 0xd5, - 0x81, 0x29, 0x88, 0x2a, 0x29, 0x09, 0x64, 0x89, 0xb4, 0xa2, 0xd4, 0xd4, 0xaa, 0x54, 0x88, 0x8c, - 0xd2, 0x44, 0x46, 0x2e, 0x1e, 0x77, 0x88, 0x89, 0xc1, 0x25, 0x89, 0x25, 0xa9, 0x42, 0x66, 0x5c, - 0x5c, 0x60, 0x75, 0x9e, 0x79, 0x69, 0xf9, 0xc5, 0x12, 0x8c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0x62, - 0x7a, 0x48, 0xb6, 0xe8, 0x85, 0xc0, 0xa4, 0x83, 0x90, 0x54, 0x0a, 0x79, 0x72, 0x09, 0x80, 0x79, - 0x4e, 0x39, 0x89, 0xc9, 0xd9, 0xe1, 0x19, 0x99, 0x25, 0xa9, 0xc5, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, - 0xdc, 0x46, 0xb2, 0x98, 0xba, 0x8b, 0xc1, 0x0a, 0xc0, 0x4a, 0x83, 0x30, 0xb4, 0x39, 0x39, 0x9d, - 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, - 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x46, 0x7a, 0x66, 0x49, 0x46, 0x69, - 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, 0x77, 0x66, 0x51, 0xa2, 0x73, 0x7e, 0x51, 0xaa, 0x7e, 0x71, - 0x6a, 0x76, 0x62, 0xa6, 0x7e, 0x05, 0xdc, 0xdf, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xef, - 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xfa, 0x08, 0x3c, 0x1f, 0x3b, 0x01, 0x00, 0x00, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x06, 0x49, 0xe9, 0x41, 0xa4, 0xa4, 0x44, 0xd2, 0xf3, + 0xd3, 0xf3, 0xc1, 0xe2, 0xfa, 0x20, 0x16, 0x44, 0x89, 0x94, 0x38, 0xb2, 0x6e, 0x30, 0x05, 0x95, + 0x90, 0x40, 0x96, 0x48, 0x2b, 0x4a, 0x4d, 0xad, 0x4a, 0x85, 0xc8, 0x28, 0xcd, 0x65, 0xe4, 0xe2, + 0x71, 0x87, 0xd8, 0x13, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0x64, 0xc3, 0xc5, 0x05, 0x56, 0xe7, 0x99, + 0x97, 0x96, 0x5f, 0x2c, 0xc1, 0xa8, 0xc0, 0xac, 0xc1, 0x6d, 0x24, 0xa6, 0x87, 0x64, 0xb7, 0x5e, + 0x08, 0x4c, 0xda, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0x24, 0xf5, 0x42, 0xfe, 0x5c, 0x02, + 0x60, 0x9e, 0x53, 0x4e, 0x62, 0x72, 0x76, 0x78, 0x46, 0x66, 0x49, 0x6a, 0xb1, 0x04, 0x93, 0x02, + 0xa3, 0x06, 0xb7, 0x91, 0x2c, 0xa6, 0x19, 0xc5, 0x60, 0x05, 0x60, 0xa5, 0x50, 0xa3, 0x30, 0x34, + 0x3b, 0x39, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, + 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x46, 0x7a, 0x66, + 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, 0x77, 0x66, 0x51, 0xa2, 0x73, 0x7e, 0x51, + 0xaa, 0x7e, 0x71, 0x6a, 0x76, 0x62, 0xa6, 0x7e, 0x05, 0x3c, 0x0c, 0x2a, 0x0b, 0x52, 0x8b, 0x93, + 0xd8, 0xc0, 0x5e, 0x35, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8c, 0x3e, 0x5d, 0x13, 0x5d, 0x01, + 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -118,18 +121,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.TokenBlackWhites != nil { - { - size, err := m.TokenBlackWhites.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + { + size, err := m.TokenBlackWhites.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x12 + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 if len(m.TokenInfos) > 0 { for iNdEx := len(m.TokenInfos) - 1; iNdEx >= 0; iNdEx-- { { @@ -170,10 +171,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if m.TokenBlackWhites != nil { - l = m.TokenBlackWhites.Size() - n += 1 + l + sovGenesis(uint64(l)) - } + l = m.TokenBlackWhites.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -241,7 +240,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TokenInfos = append(m.TokenInfos, &TokenInfo{}) + m.TokenInfos = append(m.TokenInfos, TokenInfo{}) if err := m.TokenInfos[len(m.TokenInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -275,9 +274,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.TokenBlackWhites == nil { - m.TokenBlackWhites = &TokensWhiteBlack{} - } if err := m.TokenBlackWhites.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/tokens/types/query.pb.go b/x/tokens/types/query.pb.go index 9d48a34f0..54c3253d5 100644 --- a/x/tokens/types/query.pb.go +++ b/x/tokens/types/query.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -74,7 +75,8 @@ func (m *TokenInfoRequest) GetDenom() string { } type TokenInfoResponse struct { - Data *TokenInfo `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Data *TokenInfo `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Supply types.Coin `protobuf:"bytes,2,opt,name=supply,proto3" json:"supply"` } func (m *TokenInfoResponse) Reset() { *m = TokenInfoResponse{} } @@ -117,6 +119,13 @@ func (m *TokenInfoResponse) GetData() *TokenInfo { return nil } +func (m *TokenInfoResponse) GetSupply() types.Coin { + if m != nil { + return m.Supply + } + return types.Coin{} +} + type AllTokenInfosRequest struct { } @@ -154,7 +163,7 @@ func (m *AllTokenInfosRequest) XXX_DiscardUnknown() { var xxx_messageInfo_AllTokenInfosRequest proto.InternalMessageInfo type AllTokenInfosResponse struct { - Data []*TokenInfo `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` + Data []TokenInfoResponse `protobuf:"bytes,1,rep,name=data,proto3" json:"data"` } func (m *AllTokenInfosResponse) Reset() { *m = AllTokenInfosResponse{} } @@ -190,7 +199,7 @@ func (m *AllTokenInfosResponse) XXX_DiscardUnknown() { var xxx_messageInfo_AllTokenInfosResponse proto.InternalMessageInfo -func (m *AllTokenInfosResponse) GetData() []*TokenInfo { +func (m *AllTokenInfosResponse) GetData() []TokenInfoResponse { if m != nil { return m.Data } @@ -242,7 +251,7 @@ func (m *TokenInfosByDenomRequest) GetDenoms() []string { } type TokenInfosByDenomResponse struct { - Data map[string]*TokenInfo `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Data map[string]TokenInfoResponse `protobuf:"bytes,1,rep,name=data,proto3" json:"data" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *TokenInfosByDenomResponse) Reset() { *m = TokenInfosByDenomResponse{} } @@ -278,7 +287,7 @@ func (m *TokenInfosByDenomResponse) XXX_DiscardUnknown() { var xxx_messageInfo_TokenInfosByDenomResponse proto.InternalMessageInfo -func (m *TokenInfosByDenomResponse) GetData() map[string]*TokenInfo { +func (m *TokenInfosByDenomResponse) GetData() map[string]TokenInfoResponse { if m != nil { return m.Data } @@ -322,7 +331,7 @@ func (m *TokenBlackWhitesRequest) XXX_DiscardUnknown() { var xxx_messageInfo_TokenBlackWhitesRequest proto.InternalMessageInfo type TokenBlackWhitesResponse struct { - Data *TokensWhiteBlack `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Data TokensWhiteBlack `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` } func (m *TokenBlackWhitesResponse) Reset() { *m = TokenBlackWhitesResponse{} } @@ -358,11 +367,11 @@ func (m *TokenBlackWhitesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_TokenBlackWhitesResponse proto.InternalMessageInfo -func (m *TokenBlackWhitesResponse) GetData() *TokensWhiteBlack { +func (m *TokenBlackWhitesResponse) GetData() TokensWhiteBlack { if m != nil { return m.Data } - return nil + return TokensWhiteBlack{} } func init() { @@ -372,7 +381,7 @@ func init() { proto.RegisterType((*AllTokenInfosResponse)(nil), "kira.tokens.AllTokenInfosResponse") proto.RegisterType((*TokenInfosByDenomRequest)(nil), "kira.tokens.TokenInfosByDenomRequest") proto.RegisterType((*TokenInfosByDenomResponse)(nil), "kira.tokens.TokenInfosByDenomResponse") - proto.RegisterMapType((map[string]*TokenInfo)(nil), "kira.tokens.TokenInfosByDenomResponse.DataEntry") + proto.RegisterMapType((map[string]TokenInfoResponse)(nil), "kira.tokens.TokenInfosByDenomResponse.DataEntry") proto.RegisterType((*TokenBlackWhitesRequest)(nil), "kira.tokens.TokenBlackWhitesRequest") proto.RegisterType((*TokenBlackWhitesResponse)(nil), "kira.tokens.TokenBlackWhitesResponse") } @@ -380,41 +389,45 @@ func init() { func init() { proto.RegisterFile("kira/tokens/query.proto", fileDescriptor_c8db6e46fba94960) } var fileDescriptor_c8db6e46fba94960 = []byte{ - // 544 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x8d, 0x13, 0x52, 0x29, 0x53, 0x0e, 0xe9, 0x36, 0xa4, 0x89, 0x4b, 0x2c, 0x6a, 0x28, 0x8a, - 0x10, 0xb2, 0x21, 0x5c, 0x10, 0x17, 0x44, 0x1a, 0x54, 0x21, 0x84, 0x10, 0x11, 0x12, 0x12, 0x97, - 0x68, 0xd3, 0x6e, 0x1d, 0xcb, 0xae, 0x37, 0xf5, 0xae, 0x01, 0x73, 0x44, 0xe2, 0xc2, 0x09, 0x89, - 0x3f, 0xe1, 0x2b, 0x38, 0x56, 0xe2, 0xc2, 0x11, 0x25, 0xfc, 0x06, 0x12, 0xf2, 0xee, 0xc6, 0xb5, - 0xeb, 0xb4, 0xe1, 0xe4, 0xf5, 0xcc, 0xdb, 0x79, 0x6f, 0x66, 0x9e, 0x16, 0xb6, 0x3c, 0x37, 0xc4, - 0x36, 0xa7, 0x1e, 0x09, 0x98, 0x7d, 0x12, 0x91, 0x30, 0xb6, 0xa6, 0x21, 0xe5, 0x14, 0xad, 0x27, - 0x09, 0x4b, 0x26, 0xf4, 0x1c, 0x4a, 0x7c, 0x24, 0x4a, 0x6f, 0x65, 0x13, 0x47, 0x21, 0x21, 0x1f, - 0x89, 0xca, 0x34, 0x1c, 0xea, 0x50, 0x71, 0xb4, 0x93, 0x93, 0x8a, 0x5e, 0x77, 0x28, 0x75, 0x7c, - 0x62, 0xe3, 0xa9, 0x6b, 0xe3, 0x20, 0xa0, 0x1c, 0x73, 0x97, 0x06, 0x4c, 0x66, 0xcd, 0x2e, 0xd4, - 0x5f, 0x27, 0xa5, 0x9e, 0x05, 0x47, 0x74, 0x48, 0x4e, 0x22, 0xc2, 0x38, 0x6a, 0x40, 0xf5, 0x90, - 0x04, 0xf4, 0xb8, 0xa5, 0xdd, 0xd0, 0xba, 0xb5, 0xa1, 0xfc, 0x31, 0x1f, 0xc3, 0x46, 0x06, 0xc9, - 0x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 0x6f, 0xe5, 0x4d, 0xb4, 0x61, 0x67, 0xad, 0xec, 0x26, 0x95, - 0x23, 0xa8, 0xef, 0x13, 0x9e, 0xb3, 0x03, 0xda, 0xc9, 0x95, 0x5b, 0x66, 0x21, 0xdd, 0xbc, 0x0c, - 0xa2, 0x58, 0x75, 0xc1, 0xda, 0x40, 0xa8, 0xc0, 0xca, 0xd0, 0x17, 0x0d, 0x1a, 0xd9, 0x0e, 0x17, - 0x6b, 0x45, 0xbb, 0xab, 0xd6, 0x2e, 0xf9, 0x6f, 0xff, 0x9f, 0x3b, 0xcc, 0x9b, 0x42, 0x43, 0x07, - 0x6d, 0x17, 0x35, 0x8c, 0xc6, 0xf1, 0x48, 0xf8, 0x12, 0x7d, 0xd6, 0x60, 0x73, 0x21, 0x26, 0xb3, - 0x4a, 0x74, 0xab, 0x48, 0x52, 0x34, 0x81, 0xbe, 0xbb, 0x02, 0xa5, 0x94, 0xec, 0x08, 0x25, 0xdb, - 0xa8, 0x9d, 0x53, 0x32, 0x4e, 0x90, 0xa3, 0xf7, 0x02, 0xda, 0xef, 0xff, 0x98, 0x19, 0xda, 0xe9, - 0xcc, 0xd0, 0x7e, 0xcf, 0x0c, 0xed, 0xeb, 0xdc, 0x28, 0x9d, 0xce, 0x8d, 0xd2, 0xaf, 0xb9, 0x51, - 0x7a, 0xdb, 0x75, 0x5c, 0x3e, 0x89, 0xc6, 0xd6, 0x01, 0x3d, 0xb6, 0x9f, 0xbb, 0x21, 0xde, 0xa3, - 0x21, 0xb1, 0x19, 0xf1, 0xb0, 0x6b, 0x7f, 0x48, 0x9f, 0xac, 0x78, 0x4a, 0xd8, 0x78, 0x4d, 0xbc, - 0x32, 0x0f, 0xfe, 0x05, 0x00, 0x00, 0xff, 0xff, 0xcb, 0x81, 0x7d, 0x12, 0xf4, 0x04, 0x00, 0x00, + // 607 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff,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 0xde, 0x04, 0xeb, 0x22, 0xde, 0xb5, 0xf1, 0x60, 0x7c, + 0x34, 0xb2, 0x38, 0x89, 0x87, 0xfc, 0x46, 0x4e, 0x24, 0x15, 0x92, 0xbd, 0xed, 0xa4, 0x6e, 0xbf, + 0x95, 0xf5, 0x63, 0x22, 0x41, 0xa4, 0x26, 0x1b, 0xe9, 0xfc, 0x29, 0x80, 0xe2, 0x61, 0xf8, 0x66, + 0xc0, 0x11, 0xb8, 0x75, 0x40, 0x78, 0x0c, 0x07, 0x5b, 0x37, 0x41, 0x0b, 0x1a, 0x75, 0x49, 0x4f, + 0x7a, 0xf3, 0xe3, 0xf7, 0xdf, 0x5f, 0xf3, 0x6b, 0x70, 0x15, 0x25, 0xdf, 0x22, 0x2b, 0xac, 0xec, + 0x83, 0xea, 0x01, 0xe1, 0xa9, 0x85, 0x81, 0x9b, 0xa9, 0x72, 0x8b, 0x96, 0x4c, 0xd5, 0xff, 0x25, + 0x91, 0xae, 0xaa, 0x70, 0xad, 0x41, 0x98, 0x71, 0x65, 0xf0, 0xb3, 0x02, 0x6a, 0xc9, 0x0e, 0xe7, + 0x57, 0x0d, 0xb7, 0x96, 0xad, 0x42, 0xe4, 0xff, 0xf0, 0xff, 0x36, 0x46, 0xbf, 0x2f, 0x18, 0x5a, + 0x70, 0x23, 0xcb, 0xd0, 0x37, 0x83, 0xbe, 0xd8, 0x55, 0xf8, 0x49, 0x01, 0x6b, 0x73, 0x98, 0xc4, + 0x85, 0xc2, 0x07, 0x59, 0x93, 0xec, 0x2a, 0xa8, 0x5b, 0x4b, 0x54, 0x92, 0x64, 0x53, 0x90, 0x6c, + 0xc0, 0x66, 0x8a, 0xc4, 0x0c, 0x95, 0xfd, 0xf7, 0x42, 0xda, 0xed, 0x5e, 0x4c, 0x35, 0xe5, 0x72, + 0xaa, 0x29, 0xbf, 0xa6, 0x9a, 0xf2, 0x65, 0xa6, 0xe5, 0x2e, 0x67, 0x5a, 0xee, 0xc7, 0x4c, 0xcb, + 0xbd, 0x6b, 0x0f, 0x2d, 0x3e, 0xf2, 0x4d, 0x63, 0x40, 0x27, 0xe8, 0xb5, 0xe5, 0xe1, 0x3d, 0xea, + 0x11, 0xc4, 0xc8, 0x18, 0x5b, 0xe8, 0x3c, 0xfe, 0x5a, 0x06, 0x2e, 0x61, 0x66, 0x49, 0x7c, 0xc0, + 0x9e, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x2c, 0xcb, 0xf9, 0xf0, 0x6f, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -659,6 +672,16 @@ func (m *TokenInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.Supply.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 if m.Data != nil { { size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) @@ -790,18 +813,16 @@ func (m *TokenInfosByDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro for k := range m.Data { v := m.Data[k] baseI := i - if v != nil { - { - size, err := v.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + { + size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x12 + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 i -= len(k) copy(dAtA[i:], k) i = encodeVarintQuery(dAtA, i, uint64(len(k))) @@ -858,18 +879,16 @@ func (m *TokenBlackWhitesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if m.Data != nil { - { - size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -907,6 +926,8 @@ func (m *TokenInfoResponse) Size() (n int) { l = m.Data.Size() n += 1 + l + sovQuery(uint64(l)) } + l = m.Supply.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -959,12 +980,8 @@ func (m *TokenInfosByDenomResponse) Size() (n int) { for k, v := range m.Data { _ = k _ = v - l = 0 - if v != nil { - l = v.Size() - l += 1 + sovQuery(uint64(l)) - } - mapEntrySize := 1 + len(k) + sovQuery(uint64(len(k))) + l + l = v.Size() + mapEntrySize := 1 + len(k) + sovQuery(uint64(len(k))) + 1 + l + sovQuery(uint64(l)) n += mapEntrySize + 1 + sovQuery(uint64(mapEntrySize)) } } @@ -986,10 +1003,8 @@ func (m *TokenBlackWhitesResponse) Size() (n int) { } var l int _ = l - if m.Data != nil { - l = m.Data.Size() - n += 1 + l + sovQuery(uint64(l)) - } + l = m.Data.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -1146,6 +1161,39 @@ func (m *TokenInfoResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Supply", 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 err := m.Supply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -1275,7 +1323,7 @@ func (m *AllTokenInfosResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Data = append(m.Data, &TokenInfo{}) + m.Data = append(m.Data, TokenInfoResponse{}) if err := m.Data[len(m.Data)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1442,10 +1490,10 @@ func (m *TokenInfosByDenomResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Data == nil { - m.Data = make(map[string]*TokenInfo) + m.Data = make(map[string]TokenInfoResponse) } var mapkey string - var mapvalue *TokenInfo + mapvalue := &TokenInfoResponse{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -1519,7 +1567,7 @@ func (m *TokenInfosByDenomResponse) Unmarshal(dAtA []byte) error { if postmsgIndex > l { return io.ErrUnexpectedEOF } - mapvalue = &TokenInfo{} + mapvalue = &TokenInfoResponse{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } @@ -1539,7 +1587,7 @@ func (m *TokenInfosByDenomResponse) Unmarshal(dAtA []byte) error { iNdEx += skippy } } - m.Data[mapkey] = mapvalue + m.Data[mapkey] = *mapvalue iNdEx = postIndex default: iNdEx = preIndex @@ -1670,9 +1718,6 @@ func (m *TokenBlackWhitesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Data == nil { - m.Data = &TokensWhiteBlack{} - } if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/tokens/types/types.go b/x/tokens/types/types.go index 4a588e836..e17e3c19c 100644 --- a/x/tokens/types/types.go +++ b/x/tokens/types/types.go @@ -17,8 +17,8 @@ func NewTokenInfo( name string, icon string, decimals uint32, -) *TokenInfo { - return &TokenInfo{ +) TokenInfo { + return TokenInfo{ Denom: denom, FeeRate: feeRate, FeePayments: feePayments, diff --git a/x/ubi/keeper/keeper.go b/x/ubi/keeper/keeper.go index 4edcc72d7..538e35bd3 100644 --- a/x/ubi/keeper/keeper.go +++ b/x/ubi/keeper/keeper.go @@ -15,16 +15,23 @@ type Keeper struct { bk types.BankKeeper sk types.SpendingKeeper dk types.DistrKeeper + tk types.TokensKeeper } // NewKeeper returns instance of a keeper -func NewKeeper(storeKey storetypes.StoreKey, cdc codec.BinaryCodec, bk types.BankKeeper, sk types.SpendingKeeper, dk types.DistrKeeper) Keeper { +func NewKeeper(storeKey storetypes.StoreKey, cdc codec.BinaryCodec, + bk types.BankKeeper, + sk types.SpendingKeeper, + dk types.DistrKeeper, + tk types.TokensKeeper, +) Keeper { return Keeper{ cdc: cdc, storeKey: storeKey, bk: bk, sk: sk, dk: dk, + tk: tk, } } diff --git a/x/ubi/keeper/ubi.go b/x/ubi/keeper/ubi.go index 2740358d5..44f7ddf6b 100644 --- a/x/ubi/keeper/ubi.go +++ b/x/ubi/keeper/ubi.go @@ -87,7 +87,7 @@ func (k Keeper) ProcessUBIRecord(ctx sdk.Context, record types.UBIRecord) error } coin := sdk.NewCoin(defaultDenom, amount) - err := k.bk.MintCoins(ctx, minttypes.ModuleName, sdk.NewCoins(coin)) + err := k.tk.MintCoins(ctx, minttypes.ModuleName, sdk.NewCoins(coin)) if err != nil { return err } diff --git a/x/ubi/types/expected_keepers.go b/x/ubi/types/expected_keepers.go index e2ef22d49..191d79534 100644 --- a/x/ubi/types/expected_keepers.go +++ b/x/ubi/types/expected_keepers.go @@ -3,6 +3,7 @@ package types import ( govtypes "github.com/KiraCore/sekai/x/gov/types" spendingtypes "github.com/KiraCore/sekai/x/spending/types" + tokenstypes "github.com/KiraCore/sekai/x/tokens/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -22,3 +23,9 @@ type SpendingKeeper interface { type DistrKeeper interface { InflationPossible(ctx sdk.Context) bool } + +// TokensKeeper defines expected interface needed from tokens keeper +type TokensKeeper interface { + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + GetTokenInfo(ctx sdk.Context, denom string) *tokenstypes.TokenInfo +}