Skip to content

Commit

Permalink
Merge pull request #64 from onomyprotocol/metadata
Browse files Browse the repository at this point in the history
Denom Metadata Proposal for listing and minting
  • Loading branch information
cgdusek authored Mar 9, 2024
2 parents 7d0a244 + 90e66ab commit 7afe4d9
Show file tree
Hide file tree
Showing 23 changed files with 2,131 additions and 83 deletions.
46 changes: 25 additions & 21 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ import (
"github.com/tendermint/starport/starport/pkg/openapiconsole"

"github.com/pendulum-labs/market/docs"
marketmodule "github.com/pendulum-labs/market/x/market"
marketmodulekeeper "github.com/pendulum-labs/market/x/market/keeper"
marketmoduletypes "github.com/pendulum-labs/market/x/market/types"
market "github.com/pendulum-labs/market/x/market"
marketclient "github.com/pendulum-labs/market/x/market/client"
marketkeeper "github.com/pendulum-labs/market/x/market/keeper"
marketclienttypes "github.com/pendulum-labs/market/x/market/types"
markettypes "github.com/pendulum-labs/market/x/market/types"
// this line is used by starport scaffolding # stargate/app/moduleImport
)

Expand All @@ -116,6 +118,7 @@ func getGovProposalHandlers() []govclient.ProposalHandler {
upgradeclient.CancelProposalHandler,
ibcclientclient.UpdateClientProposalHandler,
ibcclientclient.UpgradeProposalHandler,
marketclient.DenomMetadataProposalHandler,
// this line is used by starport scaffolding # stargate/app/govProposalHandler
)

Expand Down Expand Up @@ -147,7 +150,7 @@ var (
evidence.AppModuleBasic{},
transfer.AppModuleBasic{},
vesting.AppModuleBasic{},
marketmodule.AppModuleBasic{},
market.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
)

Expand All @@ -160,7 +163,7 @@ var (
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
marketmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
markettypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
// this line is used by starport scaffolding # stargate/app/maccPerms
}
)
Expand Down Expand Up @@ -224,7 +227,7 @@ type App struct {
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper

MarketKeeper marketmodulekeeper.Keeper
MarketKeeper marketkeeper.Keeper
// this line is used by starport scaffolding # stargate/app/keeperDeclaration

// mm is the module manager
Expand Down Expand Up @@ -261,7 +264,7 @@ func New(
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
marketmoduletypes.StoreKey,
markettypes.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -331,14 +334,23 @@ func New(
app.IBCKeeper = ibckeeper.NewKeeper(
appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper,
)
app.MarketKeeper = *marketkeeper.NewKeeper(
appCodec,
keys[markettypes.StoreKey],
keys[markettypes.MemStoreKey],
app.GetSubspace(markettypes.ModuleName),

app.BankKeeper,
)

// register the proposal types
govRouter := govtypes.NewRouter()
govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper))
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
AddRoute(marketclienttypes.RouterKey, market.NewDenomMetadataProposalHandler(app.MarketKeeper))

// Create Transfer Keepers
app.TransferKeeper = ibctransferkeeper.NewKeeper(
Expand Down Expand Up @@ -367,15 +379,7 @@ func New(
&stakingKeeper, govRouter,
)

app.MarketKeeper = *marketmodulekeeper.NewKeeper(
appCodec,
keys[marketmoduletypes.StoreKey],
keys[marketmoduletypes.MemStoreKey],
app.GetSubspace(marketmoduletypes.ModuleName),

app.BankKeeper,
)
marketModule := marketmodule.NewAppModule(appCodec, app.MarketKeeper, app.AccountKeeper, app.BankKeeper)
marketModule := market.NewAppModule(appCodec, app.MarketKeeper, app.AccountKeeper, app.BankKeeper)

// this line is used by starport scaffolding # stargate/app/keeperDefinition

Expand Down Expand Up @@ -441,7 +445,7 @@ func New(
evidencetypes.ModuleName,
genutiltypes.ModuleName,
ibctransfertypes.ModuleName,
marketmoduletypes.ModuleName,
markettypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand All @@ -462,7 +466,7 @@ func New(
evidencetypes.ModuleName,
genutiltypes.ModuleName,
ibctransfertypes.ModuleName,
marketmoduletypes.ModuleName,
markettypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand All @@ -488,7 +492,7 @@ func New(
evidencetypes.ModuleName,
genutiltypes.ModuleName,
ibctransfertypes.ModuleName,
marketmoduletypes.ModuleName,
markettypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
)

Expand Down Expand Up @@ -699,7 +703,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibchost.ModuleName)
paramsKeeper.Subspace(marketmoduletypes.ModuleName)
paramsKeeper.Subspace(markettypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace

return paramsKeeper
Expand Down
4 changes: 3 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
accounts:
- name: dealer
coins: ["2000000000000000000000000anom", "2000000000000000000000abtc", "20000000000000000000000wei", "20000000000000000000000stake"]
address: onomy1mczcy7z92fkyhrsctlv0ge690mzvmd9ye67mjy
- name: validator
coins: ["20000000000000000000stake"]
validator:
Expand All @@ -12,4 +11,7 @@ client:
path: "docs/static/openapi.yml"
vuex:
path: "vue/src/store"
gov:
voting_params:
voting_period": "10s"

6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ require (
github.com/cosmos/cosmos-sdk v0.45.16-ics
github.com/cosmos/ibc-go/v4 v4.4.2
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.3
github.com/golang/protobuf v1.5.4
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/spf13/cast v1.5.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.3
github.com/tendermint/starport v0.19.2
github.com/tendermint/tendermint v0.34.27
Expand Down Expand Up @@ -118,7 +119,6 @@ require (
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.14.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
Expand All @@ -136,7 +136,7 @@ require (
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/protobuf v1.32.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1434,8 +1434,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
Expand Down Expand Up @@ -3846,8 +3846,8 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
12 changes: 12 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "Cosmos Hub Atom",
"symbol": "ATOM",
"description": "The native staking token of the Cosmos Hub.",
"denom_units": [
{"denom": "uatom", "exponent": 0, "aliases": ["microatom"]},
{"denom": "matom", "exponent": 3, "aliases": ["milliatom"]},
{"denom": "atom", "exponent": 6, "aliases": []}
],
"base": "uatom",
"display": "atom"
}
20 changes: 20 additions & 0 deletions proto/market/proposal.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";
package pendulumlabs.market.market;

import "gogoproto/gogo.proto";
import "cosmos/bank/v1beta1/bank.proto";

option go_package = "github.com/pendulum-labs/market/x/market/types";
option (gogoproto.equal_all) = true;

// DenomMetadataProposal details adding denom metadata
message DenomMetadataProposal {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// option (gogoproto.goproto_stringer) = false;

string sender = 1;
string title = 2;
string description = 3;
cosmos.bank.v1beta1.Metadata metadata = 4;
}
Loading

0 comments on commit 7afe4d9

Please sign in to comment.