Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add genesis configuration to testnet, Mint denom now uses app denom d… #19

Merged
merged 2 commits into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add genesis configuration to testnet, Mint denom now uses app denom d…
…efault
  • Loading branch information
channa-figure committed Jan 27, 2021
commit 5691a38de7a23eed02fbe69547f96184b9cdce62
2 changes: 1 addition & 1 deletion cmd/provenanced/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func initGenFile(cdc codec.JSONMarshaler, mbm module.BasicManager, moniker, chai
//cdc.MustUnmarshalJSON(appGenState[mint.ModuleName], &mintGenState)
mintGenState.Minter.Inflation = sdk.ZeroDec()
mintGenState.Minter.AnnualProvisions = sdk.OneDec()
mintGenState.Params.MintDenom = "nhash"
mintGenState.Params.MintDenom = app.DefaultBondDenom
mintGenState.Params.InflationMax = sdk.ZeroDec()
mintGenState.Params.InflationMin = sdk.ZeroDec()
mintGenState.Params.InflationRateChange = sdk.OneDec()
Expand Down
32 changes: 23 additions & 9 deletions cmd/provenanced/cmd/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/provenance-io/provenance/app"
markertypes "github.com/provenance-io/provenance/x/marker/types"
nametypes "github.com/provenance-io/provenance/x/name/types"
)

Expand Down Expand Up @@ -135,6 +136,7 @@ func InitTestnet(
genAccounts []authtypes.GenesisAccount
genBalances []banktypes.Balance
genFiles []string
genMarkers []markertypes.MarkerAccount
)

inBuf := bufio.NewReader(cmd.InOrStdin())
Expand Down Expand Up @@ -248,14 +250,20 @@ func InitTestnet(
srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config/app.toml"), simappConfig)
}

// TODO -- add this when marker module is ready.
// stakeMarker := markertypes.NewEmptyMarkerAccount(app.DefaultBondDenom, []markertypes.AccessGrant{*markertypes.NewAccessGrant(genAccounts[0].GetAddress(), []string{"mint", "burn", "withdraw", "grant"})})
// stakeMarker.SetSupply(sdk.NewCoin(app.DefaultBondDenom, sdk.NewInt(100_000_000_000).Mul(sdk.NewInt(1_000_000_000))))
// stakeMarker.SetStatus(markertypes.StatusActive.String())

// genAccounts = append(genAccounts, stakeMarker)

if err := initGenFiles(clientCtx, mbm, chainID, genAccounts, genBalances, genFiles, numValidators); err != nil {
markerAcc := markertypes.NewEmptyMarkerAccount(app.DefaultBondDenom, genAccounts[0].GetAddress().String(),
[]markertypes.AccessGrant{
*markertypes.NewAccessGrant(genAccounts[0].GetAddress(), []markertypes.Access{
markertypes.Access_Admin,
markertypes.Access_Mint,
markertypes.Access_Burn,
markertypes.Access_Withdraw,
}),
})
markerAcc.SetSupply(sdk.NewCoin(app.DefaultBondDenom, sdk.NewInt(100_000_000_000).Mul(sdk.NewInt(1_000_000_000))))
markerAcc.SetStatus(markertypes.StatusActive)
genMarkers = append(genMarkers, *markerAcc)

if err := initGenFiles(clientCtx, mbm, chainID, genAccounts, genBalances, genMarkers, genFiles, numValidators); err != nil {
return err
}

Expand All @@ -274,7 +282,7 @@ func InitTestnet(
func initGenFiles(
clientCtx client.Context, mbm module.BasicManager, chainID string,
genAccounts []authtypes.GenesisAccount, genBalances []banktypes.Balance,
genFiles []string, numValidators int,
genMarkers []markertypes.MarkerAccount, genFiles []string, numValidators int,
) error {
appGenState := mbm.DefaultGenesis(clientCtx.JSONMarshaler)

Expand Down Expand Up @@ -338,6 +346,12 @@ func initGenFiles(
nameGenState.Bindings = append(nameGenState.Bindings, nametypes.NewNameRecord("provenance", genAccounts[0].GetAddress(), false))
appGenState[nametypes.ModuleName] = clientCtx.JSONMarshaler.MustMarshalJSON(&nameGenState)

//set markers
var markerGenState markertypes.GenesisState
clientCtx.JSONMarshaler.MustUnmarshalJSON(appGenState[markertypes.ModuleName], &markerGenState)
markerGenState.Markers = genMarkers
appGenState[markertypes.ModuleName] = clientCtx.JSONMarshaler.MustMarshalJSON(&markerGenState)

// END OF PROVENANCE SPECIFIC CONFIG
// --------------------------------------------

Expand Down