Skip to content

Commit

Permalink
Merge pull request #84 from RaulBernal/v2.0.0-alpha
Browse files Browse the repository at this point in the history
V2.0.0-alpha
Next goals:

NFT
Liquid Staking
Fix/Delete Ignite CLI
Upgrade handler for v0.45 -> v0.46 migration
  • Loading branch information
RaulBernal authored Sep 29, 2022
2 parents 119607f + 529d7fb commit 353ea14
Show file tree
Hide file tree
Showing 26 changed files with 41,840 additions and 20,166 deletions.
386 changes: 207 additions & 179 deletions app/app.go

Large diffs are not rendered by default.

20 changes: 15 additions & 5 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
func (app *App) ExportAppStateAndValidators(
forZeroHeight bool, jailAllowedAddrs []string,
) (servertypes.ExportedApp, error) {

// as if they could withdraw from the start of the next block
ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})

Expand Down Expand Up @@ -49,8 +50,7 @@ func (app *App) ExportAppStateAndValidators(

// prepare for fresh start at zero height
// NOTE zero height genesis is a temporary feature which will be deprecated
//
// in favour of export at a block height
// in favour of export at a block height
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
applyAllowedAddrs := false

Expand Down Expand Up @@ -110,14 +110,23 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str
feePool.CommunityPool = feePool.CommunityPool.Add(scraps...)
app.DistrKeeper.SetFeePool(ctx, feePool)

app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator())
err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator())
if err != nil {
panic(err)
}
return false
})

// reinitialize all delegations
for _, del := range dels {
app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr())
app.DistrKeeper.Hooks().AfterDelegationModified(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr())
err := app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr())
if err != nil {
panic(err)
}
err = app.DistrKeeper.Hooks().AfterDelegationModified(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr())
if err != nil {
panic(err)
}
}

// reset context height
Expand Down Expand Up @@ -150,6 +159,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str
counter := int16(0)

for ; iter.Valid(); iter.Next() {
// https://github.com/BitCannaGlobal/bcna/pull/68/files
addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key()))
validator, found := app.StakingKeeper.GetValidator(ctx, addr)
if !found {
Expand Down
1 change: 0 additions & 1 deletion app/simulation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ type SimApp interface {
InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
}

//nolint:deadcode,unused,varcheck // This is used for tests, I think.
var defaultConsensusParams = &abci.ConsensusParams{
Block: &abci.BlockParams{
MaxBytes: 200000,
Expand Down
6 changes: 4 additions & 2 deletions cmd/bcnad/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@ package main

import (
"os"
"strings"

"github.com/BitCannaGlobal/bcna/app"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/ignite/cli/ignite/pkg/cosmoscmd"
"github.com/ignite/cli/ignite/pkg/xstrings"
)

func main() {
rootCmd, _ := cosmoscmd.NewRootCmd(
app.Name,
app.AccountAddressPrefix,
app.DefaultNodeHome,
app.Name,
xstrings.NoDash(app.Name),
app.ModuleBasics,
app.New,
// this line is used by starport scaffolding # root/arguments
)
if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil {
if err := svrcmd.Execute(rootCmd, strings.ToUpper(app.Name), app.DefaultNodeHome); err != nil {
os.Exit(1)
}
}
Loading

0 comments on commit 353ea14

Please sign in to comment.