Skip to content

Commit

Permalink
added gov module + config changes + license
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtau committed Sep 1, 2020
1 parent 37b2ecb commit cd76a4e
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 48 deletions.
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2018 - 2020, Foris Limited ("Crypto.com").

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
71 changes: 47 additions & 24 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,34 @@ import (
"github.com/crypto-com/chain-main/x/chainmain"
chainmainkeeper "github.com/crypto-com/chain-main/x/chainmain/keeper"
chainmaintypes "github.com/crypto-com/chain-main/x/chainmain/types"
// this line is used by starport scaffolding
// this line is used by starport scaffolding
distr "github.com/cosmos/cosmos-sdk/x/distribution"
"github.com/cosmos/cosmos-sdk/x/gov"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
)

const appName = "chainmain"
const appName = "Crypto.com Chain"

var (
DefaultCLIHome = os.ExpandEnv("$HOME/.chainmaincli")
DefaultCLIHome = os.ExpandEnv("$HOME/.chainmaincli")
DefaultNodeHome = os.ExpandEnv("$HOME/.chainmaind")
ModuleBasics = module.NewBasicManager(
ModuleBasics = module.NewBasicManager(
genutil.AppModuleBasic{},
auth.AppModuleBasic{},
bank.AppModuleBasic{},
staking.AppModuleBasic{},
params.AppModuleBasic{},
supply.AppModuleBasic{},
chainmain.AppModuleBasic{},
// this line is used by starport scaffolding # 2
// this line is used by starport scaffolding # 2
gov.NewAppModuleBasic(paramsclient.ProposalHandler, distr.ProposalHandler),
)

maccPerms = map[string][]string{
auth.FeeCollectorName: nil,
staking.BondedPoolName: {supply.Burner, supply.Staking},
staking.NotBondedPoolName: {supply.Burner, supply.Staking},
gov.ModuleName: {supply.Burner},
}
)

Expand All @@ -72,16 +77,16 @@ type NewApp struct {

subspaces map[string]params.Subspace

accountKeeper auth.AccountKeeper
bankKeeper bank.Keeper
stakingKeeper staking.Keeper
supplyKeeper supply.Keeper
paramsKeeper params.Keeper
accountKeeper auth.AccountKeeper
bankKeeper bank.Keeper
stakingKeeper staking.Keeper
supplyKeeper supply.Keeper
paramsKeeper params.Keeper
chainmainKeeper chainmainkeeper.Keeper
// this line is used by starport scaffolding # 3
mm *module.Manager

sm *module.SimulationManager
// this line is used by starport scaffolding # 3
mm *module.Manager
govKeeper gov.Keeper
sm *module.SimulationManager
}

var _ simapp.App = (*NewApp)(nil)
Expand All @@ -97,14 +102,15 @@ func NewInitApp(
bApp.SetAppVersion(version.Version)

keys := sdk.NewKVStoreKeys(
bam.MainStoreKey,
auth.StoreKey,
staking.StoreKey,
bam.MainStoreKey,
auth.StoreKey,
staking.StoreKey,
supply.StoreKey,
params.StoreKey,
chainmaintypes.StoreKey,
// this line is used by starport scaffolding # 5
)
params.StoreKey,
chainmaintypes.StoreKey,
gov.StoreKey,
// this line is used by starport scaffolding # 5
)

tKeys := sdk.NewTransientStoreKeys(staking.TStoreKey, params.TStoreKey)

Expand All @@ -121,6 +127,7 @@ func NewInitApp(
app.subspaces[auth.ModuleName] = app.paramsKeeper.Subspace(auth.DefaultParamspace)
app.subspaces[bank.ModuleName] = app.paramsKeeper.Subspace(bank.DefaultParamspace)
app.subspaces[staking.ModuleName] = app.paramsKeeper.Subspace(staking.DefaultParamspace)
govSubspace := app.paramsKeeper.Subspace(gov.DefaultParamspace).WithKeyTable(gov.ParamKeyTable())

app.accountKeeper = auth.NewAccountKeeper(
app.cdc,
Expand Down Expand Up @@ -160,7 +167,19 @@ func NewInitApp(
keys[chainmaintypes.StoreKey],
)

// this line is used by starport scaffolding # 4
govRouter := gov.NewRouter()
govRouter.AddRoute(gov.RouterKey, gov.ProposalHandler)

app.govKeeper = gov.NewKeeper(
app.cdc,
keys[gov.StoreKey],
govSubspace,
app.supplyKeeper,
&stakingKeeper,
govRouter,
)

// this line is used by starport scaffolding # 4

app.mm = module.NewManager(
genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx),
Expand All @@ -169,19 +188,23 @@ func NewInitApp(
supply.NewAppModule(app.supplyKeeper, app.accountKeeper),
chainmain.NewAppModule(app.chainmainKeeper, app.bankKeeper),
staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper),
// this line is used by starport scaffolding # 6
// this line is used by starport scaffolding # 6
gov.NewAppModule(app.govKeeper, app.accountKeeper, app.supplyKeeper),
)

app.mm.SetOrderEndBlockers(staking.ModuleName)

app.mm.SetOrderEndBlockers(gov.ModuleName, staking.ModuleName)

app.mm.SetOrderInitGenesis(
staking.ModuleName,
auth.ModuleName,
bank.ModuleName,
chainmaintypes.ModuleName,
supply.ModuleName,
genutil.ModuleName,
// this line is used by starport scaffolding # 7
gov.ModuleName,
// this line is used by starport scaffolding # 7
)

app.mm.RegisterRoutes(app.Router(), app.QueryRouter())
Expand Down
8 changes: 4 additions & 4 deletions app/prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
var (
AccountAddressPrefix = "cro"
AccountPubKeyPrefix = "cropub"
ValidatorAddressPrefix = "crovaloper"
ValidatorPubKeyPrefix = "crovaloperpub"
ConsNodeAddressPrefix = "crovalcons"
ConsNodePubKeyPrefix = "crovalconspub"
ValidatorAddressPrefix = "crocncl"
ValidatorPubKeyPrefix = "crocnclpub"
ConsNodeAddressPrefix = "crocnclcons"
ConsNodePubKeyPrefix = "crocnclconspub"
)

func SetConfig() {
Expand Down
14 changes: 10 additions & 4 deletions config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
accounts:
- name: user1
coins: ["1000token", "100000000stake"]
- name: user2
coins: ["500token"]
- name: testvalidator
coins: ["100000000stake"]
- name: community
coins: ["10000000000token"]
- name: ecosystem
coins: ["20000000000token"]
- name: reserve
coins: ["20000000000token"]
- name: launch
coins: ["10000000000token"]
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.14
require (
github.com/cosmos/cosmos-sdk v0.39.0
github.com/golang/mock v1.4.3 // indirect
github.com/google/uuid v1.0.0
github.com/gorilla/mux v1.7.4
github.com/onsi/ginkgo v1.8.0 // indirect
github.com/onsi/gomega v1.5.0 // indirect
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cosmos/cosmos-sdk v0.39.0 h1:lWZQLFxLYQ4ydD01cDZF7tRF8IN2xclDmoNPIJ5Kw44=
github.com/cosmos/cosmos-sdk v0.39.0/go.mod h1:3iKiqnQ48T0UG4IDw9EM8utQSwItutLUkmGkRSWpS5U=
github.com/cosmos/cosmos-sdk v0.39.1 h1:vhjf9PZh9ph8btAj9aBpHoVITgVVjNBpM3x5Gl/Vwac=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4=
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# chainmain
# Crypto.com Chain

**chainmain** is a blockchain application built using Cosmos SDK and Tendermint and generated with [Starport](https://github.com/tendermint/starport).
**Crypto.com Chain** is a blockchain application built using Cosmos SDK and Tendermint and generated with [Starport](https://github.com/tendermint/starport).

## Get started

Expand Down
2 changes: 1 addition & 1 deletion vue/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# chainmain
# Test frontend for Crypto.com Chain

## Project setup

Expand Down
15 changes: 3 additions & 12 deletions x/chainmain/spec/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
# chainmain module specification
# Crypto.com Chain module specification

## Abstract

<!-- TODO: Create a abstract definition of what this module does, what functionality does it enable and how it can be used. -->
TODO

## Contents

// TODO: Create the below files if they are needed.

1. **[Concepts](01_concepts.md)**
2. **[State](02_state.md)**
3. **[Messages](03_messages.md)**
4. **[Begin-Block](04_begin_block.md)**
5. **[End-Block](05_end_block.md)**
6. **[Hooks](06_hooks.md)**
7. **[Events](07_events.md)**
8. **[Parameters](08_params.md)**
TODO

0 comments on commit cd76a4e

Please sign in to comment.