diff --git a/Makefile b/Makefile index b05b9bd..367bb7b 100644 --- a/Makefile +++ b/Makefile @@ -129,7 +129,7 @@ test: COV_ROOT="/tmp/tokenfactory-coverage" COV_UNIT_E2E="${COV_ROOT}/unit-e2e" COV_SIMULATION="${COV_ROOT}/simulation" -COV_PKG="github.com/strangelove-ventures/tokenfactory/..." +COV_PKG="github.com/MissingNO57/tokenfactory/..." COV_SIM_CMD=${COV_SIMULATION}/simulation.test COV_SIM_COMMON=-Enabled=True -NumBlocks=100 -Commit=true -Period=5 -Verbose=false -test.v -test.gocoverdir=${COV_SIMULATION} diff --git a/app/app.go b/app/app.go index 0474db9..ff223e7 100644 --- a/app/app.go +++ b/app/app.go @@ -519,7 +519,7 @@ func NewApp( app.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( - // register the governance hooks + // register the governance hooks ), ) @@ -551,7 +551,7 @@ func NewApp( app.BankKeeper, app.DistrKeeper, tokenFactoryCapabilities, - tokenfactorykeeper.DefaultIsSudoAdminFunc, + nil, govModAddress, ) wasmOpts = append(wasmOpts, bindings.RegisterCustomPlugins(app.BankKeeper, &app.TokenFactoryKeeper)...) diff --git a/go.mod b/go.mod index d42d81b..af0889b 100644 --- a/go.mod +++ b/go.mod @@ -228,7 +228,6 @@ require ( github.com/cloudwego/base64x v0.1.5 // indirect github.com/cncf/xds/go v0.0.0-20250121191232-2f005788dc42 // indirect github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a // indirect - github.com/cosmos/ibc-go/v10 v10.3.0 // indirect github.com/dgraph-io/badger/v4 v4.2.0 // indirect github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect diff --git a/go.sum b/go.sum index 75ca9c0..aa9f3b2 100644 --- a/go.sum +++ b/go.sum @@ -835,12 +835,10 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.4 h1:IHUrG8dkyueKEY72y92jajrizbkZKPZbMmG14QzsEkw= github.com/cosmos/iavl v1.2.4/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= -github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco= +github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= +github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= github.com/cosmos/ibc-go/v10 v10.3.0 h1:w5DkHih8qn15deAeFoTk778WJU+xC1krJ5kDnicfUBc= github.com/cosmos/ibc-go/v10 v10.3.0/go.mod h1:CthaR7n4d23PJJ7wZHegmNgbVcLXCQql7EwHrAXnMtw= -github.com/cosmos/ibc-go/v10 v8.2.0 h1:7oCzyy1sZCcgpeQLnHxC56brsSz3KWwQGKXalXwXFzE= -github.com/cosmos/ibc-go/v10 v8.2.0/go.mod h1:wj3qx75iC/XNnsMqbPDCIGs0G6Y3E/lo3bdqCyoCy+8= github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.14.0 h1:WfCHricT3rPbkPSVKRH+L4fQGKYHuGOK9Edpel8TYpE= diff --git a/proto/osmosis/tokenfactory/v1beta1/genesis.proto b/proto/osmosis/tokenfactory/v1beta1/genesis.proto index 83d0cff..138c35f 100755 --- a/proto/osmosis/tokenfactory/v1beta1/genesis.proto +++ b/proto/osmosis/tokenfactory/v1beta1/genesis.proto @@ -4,6 +4,7 @@ package osmosis.tokenfactory.v1beta1; import "gogoproto/gogo.proto"; import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto"; import "osmosis/tokenfactory/v1beta1/params.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/strangelove-ventures/tokenfactory/x/tokenfactory/types"; @@ -16,6 +17,12 @@ message GenesisState { (gogoproto.moretags) = "yaml:\"factory_denoms\"", (gogoproto.nullable) = false ]; + + repeated string sudo_admins = 3 [ + (cosmos_proto.scalar) = "cosmos.AddressString", + (gogoproto.moretags) = "yaml:\"sudo_admins\"", + (gogoproto.nullable) = false + ]; } // GenesisDenom defines a tokenfactory denom that is defined within genesis diff --git a/x/tokenfactory/keeper/genesis.go b/x/tokenfactory/keeper/genesis.go index b161d07..f3a9eba 100644 --- a/x/tokenfactory/keeper/genesis.go +++ b/x/tokenfactory/keeper/genesis.go @@ -30,6 +30,13 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { panic(err) } } + + for _, genAdmin := range genState.GetSudoAdmins() { + err := k.AddSudoAdmin(ctx, genAdmin) + if err != nil { + panic(err) + } + } } // ExportGenesis returns the tokenfactory module's exported genesis. diff --git a/x/tokenfactory/keeper/keeper.go b/x/tokenfactory/keeper/keeper.go index c7b7089..9baf8e6 100644 --- a/x/tokenfactory/keeper/keeper.go +++ b/x/tokenfactory/keeper/keeper.go @@ -47,7 +47,7 @@ func NewKeeper( bankKeeper types.BankKeeper, communityPoolKeeper types.CommunityPoolKeeper, enabledCapabilities []string, - // use DefaultIsSudoAdminFunc if you don't have a custom one +// use DefaultIsSudoAdminFunc if nil isSudoAdminFunc IsSudoAdmin, authority string, ) Keeper { @@ -56,7 +56,7 @@ func NewKeeper( permAddrs[name] = authtypes.NewPermissionsForAddress(name, perms) } - return Keeper{ + k := Keeper{ cdc: cdc, storeKey: storeKey, permAddrs: permAddrs, @@ -68,14 +68,28 @@ func NewKeeper( authority: authority, enabledCapabilities: enabledCapabilities, + } - IsSudoAdminFunc: isSudoAdminFunc, + if isSudoAdminFunc == nil { + k.IsSudoAdminFunc = k.DefaultIsSudoAdminFunc + } else { + k.IsSudoAdminFunc = isSudoAdminFunc } + + return k } // DefaultIsSudoAdminFunc returns false for all addresses. -func DefaultIsSudoAdminFunc(_ context.Context, _ string) bool { - return false +func (k Keeper) DefaultIsSudoAdminFunc(ctx context.Context, addr string) bool { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := k.GetSudoAdminsStore(sdkCtx) + + accAddr, err := sdk.AccAddressFromBech32(addr) + if err != nil { + return false + } + + return store.Has(accAddr.Bytes()) } // GetAuthority returns the x/mint module's authority. @@ -113,3 +127,9 @@ func (k Keeper) GetCreatorsPrefixStore(ctx sdk.Context) store.KVStore { store := ctx.KVStore(k.storeKey) return prefix.NewStore(store, types.GetCreatorsPrefix()) } + +// GetSudoAdminsStore returns the substore for sudoers +func (k Keeper) GetSudoAdminsStore(ctx sdk.Context) store.KVStore { + store := ctx.KVStore(k.storeKey) + return prefix.NewStore(store, types.GetSudoAdmins()) +} diff --git a/x/tokenfactory/keeper/sudoadmins.go b/x/tokenfactory/keeper/sudoadmins.go new file mode 100644 index 0000000..ffb80df --- /dev/null +++ b/x/tokenfactory/keeper/sudoadmins.go @@ -0,0 +1,47 @@ +package keeper + +import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k Keeper) AddSudoAdmin(ctx context.Context, admin string) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := k.GetSudoAdminsStore(sdkCtx) + + addr, err := sdk.AccAddressFromBech32(admin) + if err != nil { + return err + } + + // key = canonical address bytes + // value = dummy marker + store.Set(addr.Bytes(), []byte{1}) + + return nil +} + +func (k Keeper) RemoveSudoAdmin(ctx context.Context, admin string) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := k.GetSudoAdminsStore(sdkCtx) + + addr, err := sdk.AccAddressFromBech32(admin) + if err != nil { + return err + } + + store.Delete(addr.Bytes()) + return nil +} + +func (k Keeper) IsSudoAdmin(ctx context.Context, admin string) bool { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := k.GetSudoAdminsStore(sdkCtx) + + addr, err := sdk.AccAddressFromBech32(admin) + if err != nil { + return false + } + + return store.Has(addr.Bytes()) +} diff --git a/x/tokenfactory/types/genesis.go b/x/tokenfactory/types/genesis.go index 408dc5f..3c2c5f5 100644 --- a/x/tokenfactory/types/genesis.go +++ b/x/tokenfactory/types/genesis.go @@ -16,6 +16,7 @@ func DefaultGenesis() *GenesisState { return &GenesisState{ Params: DefaultParams(), FactoryDenoms: []GenesisDenom{}, + SudoAdmins: []string{}, } } diff --git a/x/tokenfactory/types/genesis.pb.go b/x/tokenfactory/types/genesis.pb.go index 26b7374..8d3c762 100644 --- a/x/tokenfactory/types/genesis.pb.go +++ b/x/tokenfactory/types/genesis.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -28,6 +29,7 @@ type GenesisState struct { // params defines the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` FactoryDenoms []GenesisDenom `protobuf:"bytes,2,rep,name=factory_denoms,json=factoryDenoms,proto3" json:"factory_denoms" yaml:"factory_denoms"` + SudoAdmins []string `protobuf:"bytes,3,rep,name=sudo_admins,json=sudoAdmins,proto3" json:"sudo_admins,omitempty" yaml:"sudo_admins"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -77,6 +79,13 @@ func (m *GenesisState) GetFactoryDenoms() []GenesisDenom { return nil } +func (m *GenesisState) GetSudoAdmins() []string { + if m != nil { + return m.SudoAdmins + } + return nil +} + // GenesisDenom defines a tokenfactory denom that is defined within genesis // state. The structure contains DenomAuthorityMetadata which defines the // denom's admin. @@ -142,31 +151,35 @@ func init() { } var fileDescriptor_5749c3f71850298b = []byte{ - // 372 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xca, 0x2f, 0xce, 0xcd, - 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0xc9, 0xcf, 0x4e, 0xcd, 0x4b, 0x4b, 0x4c, 0x2e, 0xc9, 0x2f, 0xaa, - 0xd4, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, - 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x81, 0xaa, 0xd5, 0x43, 0x56, 0xab, 0x07, 0x55, - 0x2b, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa8, 0x0f, 0x62, 0x41, 0xf4, 0x48, 0x99, 0xe0, - 0x35, 0x3f, 0xb1, 0xb4, 0x24, 0x23, 0xbf, 0x28, 0xb3, 0xa4, 0xd2, 0x37, 0xb5, 0x24, 0x31, 0x25, - 0xb1, 0x24, 0x11, 0xaa, 0x4b, 0x13, 0xaf, 0xae, 0x82, 0xc4, 0xa2, 0xc4, 0x5c, 0xa8, 0xa3, 0x94, - 0x8e, 0x30, 0x72, 0xf1, 0xb8, 0x43, 0x9c, 0x19, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0xe4, 0xc4, 0xc5, - 0x06, 0x51, 0x20, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0xa4, 0xa2, 0x87, 0xcf, 0xd9, 0x7a, 0x01, - 0x60, 0xb5, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0x75, 0x0a, 0x15, 0x70, 0xf1, 0x41, - 0xd5, 0xc5, 0xa7, 0xa4, 0xe6, 0xe5, 0xe7, 0x16, 0x4b, 0x30, 0x29, 0x30, 0x6b, 0x70, 0x1b, 0x69, - 0xe1, 0x37, 0x0b, 0xea, 0x0e, 0x17, 0x90, 0x16, 0x27, 0x59, 0x90, 0x89, 0x9f, 0xee, 0xc9, 0x8b, - 0x56, 0x26, 0xe6, 0xe6, 0x58, 0x29, 0xa1, 0x9a, 0xa7, 0x14, 0xc4, 0x0b, 0x15, 0x70, 0x81, 0xf0, - 0x8f, 0x22, 0xbc, 0x01, 0x16, 0x11, 0x52, 0xe3, 0x62, 0x05, 0x2b, 0x05, 0xfb, 0x82, 0xd3, 0x49, - 0xe0, 0xd3, 0x3d, 0x79, 0x1e, 0x88, 0x49, 0x60, 0x61, 0xa5, 0x20, 0x88, 0xb4, 0x50, 0x1b, 0x23, - 0x97, 0x10, 0x3c, 0x18, 0xe3, 0x73, 0xa1, 0xe1, 0x28, 0xc1, 0x04, 0xf6, 0xbb, 0x09, 0x7e, 0xf7, - 0x82, 0x6d, 0x72, 0x44, 0x8f, 0x03, 0x27, 0x45, 0xa8, 0xcb, 0x25, 0x21, 0xf6, 0x61, 0x9a, 0xae, - 0x14, 0x24, 0x88, 0x11, 0x73, 0x56, 0x2c, 0x2f, 0x16, 0xc8, 0x33, 0x3a, 0x45, 0x9f, 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, 0x63, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, - 0x72, 0x7e, 0xae, 0x7e, 0x71, 0x49, 0x51, 0x62, 0x5e, 0x7a, 0x6a, 0x4e, 0x7e, 0x59, 0xaa, 0x6e, - 0x59, 0x6a, 0x5e, 0x49, 0x69, 0x51, 0x2a, 0x5a, 0x5c, 0x57, 0xa0, 0x72, 0x4b, 0x2a, 0x0b, 0x52, - 0x8b, 0x93, 0xd8, 0xc0, 0x51, 0x6e, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x83, 0x56, 0x6d, 0x5f, - 0xb5, 0x02, 0x00, 0x00, + // 438 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x4f, 0x8b, 0xd3, 0x40, + 0x18, 0xc6, 0x33, 0xed, 0xba, 0xb0, 0xd3, 0x55, 0x74, 0x58, 0x21, 0x5b, 0x34, 0xa9, 0x41, 0xa4, + 0x2e, 0x6c, 0xc2, 0xd6, 0x3d, 0xed, 0x2d, 0x41, 0xf0, 0x24, 0x48, 0x7a, 0xd3, 0x43, 0x98, 0x36, + 0x63, 0x1a, 0x6c, 0x32, 0x61, 0x66, 0x52, 0xcc, 0x17, 0xf0, 0xec, 0xd5, 0x9b, 0x1f, 0xc2, 0xaf, + 0x20, 0xf4, 0x58, 0x3c, 0x79, 0x2a, 0xd2, 0x5e, 0x3c, 0xf7, 0x13, 0x2c, 0x99, 0x19, 0x4a, 0xff, + 0x40, 0x6e, 0xc9, 0xcc, 0xef, 0x79, 0xde, 0x79, 0x9f, 0xf7, 0x85, 0x57, 0x94, 0x67, 0x94, 0xa7, + 0xdc, 0x13, 0xf4, 0x0b, 0xc9, 0x3f, 0xe3, 0xb1, 0xa0, 0xac, 0xf2, 0x66, 0x37, 0x23, 0x22, 0xf0, + 0x8d, 0x97, 0x90, 0x9c, 0xf0, 0x94, 0xbb, 0x05, 0xa3, 0x82, 0xa2, 0x67, 0x9a, 0x75, 0x77, 0x59, + 0x57, 0xb3, 0xdd, 0x8b, 0x84, 0x26, 0x54, 0x82, 0x5e, 0xfd, 0xa5, 0x34, 0xdd, 0xdb, 0x46, 0x7f, + 0x5c, 0x8a, 0x09, 0x65, 0xa9, 0xa8, 0xde, 0x13, 0x81, 0x63, 0x2c, 0xb0, 0x56, 0xbd, 0x6e, 0x54, + 0x15, 0x98, 0xe1, 0x4c, 0x3f, 0xaa, 0x7b, 0x39, 0x96, 0x6c, 0xa4, 0x2a, 0xab, 0x1f, 0x75, 0xe5, + 0xfc, 0x68, 0xc1, 0xf3, 0x77, 0xaa, 0x83, 0xa1, 0xc0, 0x82, 0xa0, 0x00, 0x9e, 0x2a, 0xad, 0x09, + 0x7a, 0xa0, 0xdf, 0x19, 0xbc, 0x74, 0x9b, 0x3a, 0x72, 0x3f, 0x48, 0x36, 0x38, 0x99, 0x2f, 0x6d, + 0x23, 0xd4, 0x4a, 0x54, 0xc0, 0x47, 0x9a, 0x8b, 0x62, 0x92, 0xd3, 0x8c, 0x9b, 0xad, 0x5e, 0xbb, + 0xdf, 0x19, 0x5c, 0x35, 0x7b, 0xe9, 0x77, 0xbc, 0xad, 0x25, 0xc1, 0xf3, 0xda, 0x71, 0xb3, 0xb4, + 0x9f, 0x56, 0x38, 0x9b, 0xde, 0x39, 0xfb, 0x7e, 0x4e, 0xf8, 0x50, 0x1f, 0x48, 0x98, 0xa3, 0x21, + 0xec, 0xf0, 0x32, 0xa6, 0x11, 0x8e, 0xb3, 0x34, 0xe7, 0x66, 0xbb, 0xd7, 0xee, 0x9f, 0x05, 0x03, + 0x6d, 0x81, 0x94, 0xc5, 0x0e, 0xe0, 0xfc, 0xf9, 0x75, 0x7d, 0xa1, 0x73, 0xf0, 0xe3, 0x98, 0x11, + 0xce, 0x87, 0x82, 0xa5, 0x79, 0x12, 0xc2, 0x9a, 0xf2, 0x15, 0xf4, 0x1b, 0x6c, 0xb3, 0x91, 0x65, + 0xd0, 0x2b, 0xf8, 0x40, 0xd6, 0x97, 0xd1, 0x9c, 0x05, 0x8f, 0x37, 0x4b, 0xfb, 0x5c, 0x79, 0xcb, + 0x63, 0x27, 0x54, 0xd7, 0xe8, 0x1b, 0x80, 0x68, 0x3b, 0xb6, 0x28, 0xd3, 0x73, 0x33, 0x5b, 0x32, + 0xd0, 0xdb, 0xe6, 0x10, 0x64, 0x25, 0xff, 0x70, 0xe6, 0xc1, 0x0b, 0xdd, 0xcb, 0xa5, 0xaa, 0x77, + 0xec, 0xee, 0x84, 0x4f, 0x8e, 0x36, 0xe5, 0xee, 0xe4, 0xff, 0x4f, 0x1b, 0x04, 0x9f, 0xe6, 0x2b, + 0x0b, 0x2c, 0x56, 0x16, 0xf8, 0xb7, 0xb2, 0xc0, 0xf7, 0xb5, 0x65, 0x2c, 0xd6, 0x96, 0xf1, 0x77, + 0x6d, 0x19, 0x1f, 0xfd, 0x24, 0x15, 0x93, 0x72, 0xe4, 0x8e, 0x69, 0xe6, 0x71, 0xc1, 0x70, 0x9e, + 0x90, 0x29, 0x9d, 0x91, 0xeb, 0x19, 0xc9, 0x45, 0xc9, 0xc8, 0xc1, 0x6e, 0x7d, 0xdd, 0xff, 0x15, + 0x55, 0x41, 0xf8, 0xe8, 0x54, 0xee, 0xd1, 0x9b, 0xfb, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x9c, + 0x73, 0x96, 0x25, 0x03, 0x00, 0x00, } func (this *GenesisDenom) Equal(that interface{}) bool { @@ -216,6 +229,15 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.SudoAdmins) > 0 { + for iNdEx := len(m.SudoAdmins) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SudoAdmins[iNdEx]) + copy(dAtA[i:], m.SudoAdmins[iNdEx]) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.SudoAdmins[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } if len(m.FactoryDenoms) > 0 { for iNdEx := len(m.FactoryDenoms) - 1; iNdEx >= 0; iNdEx-- { { @@ -308,6 +330,12 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if len(m.SudoAdmins) > 0 { + for _, s := range m.SudoAdmins { + l = len(s) + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -428,6 +456,38 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SudoAdmins", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SudoAdmins = append(m.SudoAdmins, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/tokenfactory/types/keys.go b/x/tokenfactory/types/keys.go index bb52b5d..a122214 100644 --- a/x/tokenfactory/types/keys.go +++ b/x/tokenfactory/types/keys.go @@ -31,6 +31,7 @@ var ( DenomsPrefixKey = "denoms" CreatorPrefixKey = "creator" AdminPrefixKey = "admin" + KeySudoAdmins = "sudoadmins" ) // GetDenomPrefixStore returns the store prefix where all the data associated with a specific denom @@ -49,3 +50,8 @@ func GetCreatorPrefix(creator string) []byte { func GetCreatorsPrefix() []byte { return []byte(strings.Join([]string{CreatorPrefixKey, ""}, KeySeparator)) } + +// GetSudoAdmins returns the store prefix where a list of all sudo admin addresses are stored +func GetSudoAdmins() []byte { + return []byte(strings.Join([]string{KeySudoAdmins, ""}, KeySeparator)) +}