Skip to content

Commit

Permalink
apply finschia-sdk v0.49.0-rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed May 8, 2024
1 parent 78f9d87 commit 208930a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
35 changes: 33 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,20 @@ import (
"github.com/Finschia/finschia-sdk/x/evidence"
evidencekeeper "github.com/Finschia/finschia-sdk/x/evidence/keeper"
evidencetypes "github.com/Finschia/finschia-sdk/x/evidence/types"
fbridgekeeper "github.com/Finschia/finschia-sdk/x/fbridge/keeper"
fbridgemodule "github.com/Finschia/finschia-sdk/x/fbridge/module"
fbridgetypes "github.com/Finschia/finschia-sdk/x/fbridge/types"
"github.com/Finschia/finschia-sdk/x/feegrant"
feegrantkeeper "github.com/Finschia/finschia-sdk/x/feegrant/keeper"
feegrantmodule "github.com/Finschia/finschia-sdk/x/feegrant/module"
"github.com/Finschia/finschia-sdk/x/foundation"
foundationclient "github.com/Finschia/finschia-sdk/x/foundation/client"
foundationkeeper "github.com/Finschia/finschia-sdk/x/foundation/keeper"
foundationmodule "github.com/Finschia/finschia-sdk/x/foundation/module"
"github.com/Finschia/finschia-sdk/x/fswap"
fswapclient "github.com/Finschia/finschia-sdk/x/fswap/client"
fswapkeeper "github.com/Finschia/finschia-sdk/x/fswap/keeper"
fswaptypes "github.com/Finschia/finschia-sdk/x/fswap/types"
"github.com/Finschia/finschia-sdk/x/genutil"
genutiltypes "github.com/Finschia/finschia-sdk/x/genutil/types"
"github.com/Finschia/finschia-sdk/x/gov"
Expand Down Expand Up @@ -157,6 +164,7 @@ var (
foundationclient.ProposalHandler,
ibcclientclient.UpdateClientProposalHandler,
ibcclientclient.UpgradeProposalHandler,
fswapclient.ProposalHandler,
)...,
),
params.AppModuleBasic{},
Expand All @@ -173,6 +181,8 @@ var (
transfer.AppModuleBasic{},
ica.AppModuleBasic{},
wasmplus.AppModuleBasic{},
fswap.AppModuleBasic{},
fbridgemodule.AppModuleBasic{},
)

// module account permissions
Expand All @@ -188,11 +198,14 @@ var (
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
wasmplustypes.ModuleName: {authtypes.Burner},
fbridgetypes.ModuleName: {authtypes.Burner},
fswaptypes.ModuleName: {authtypes.Burner, authtypes.Minter},
}

// module accounts that are allowed to receive tokens
allowedReceivingModAcc = map[string]bool{
// govtypes.ModuleName: true, // TODO: uncomment it when authority is ready
fbridgetypes.ModuleName: true,
}
)

Expand Down Expand Up @@ -240,6 +253,8 @@ type LinkApp struct { // nolint: golint
TokenKeeper tokenkeeper.Keeper
CollectionKeeper collectionkeeper.Keeper
WasmKeeper wasmpluskeeper.Keeper
FswapKeeper fswapkeeper.Keeper
FbridgeKeeper fbridgekeeper.Keeper

ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -301,12 +316,14 @@ func NewLinkApp(
ibctransfertypes.StoreKey,
icahosttypes.StoreKey,
wasmplustypes.StoreKey,
fswaptypes.StoreKey,
fbridgetypes.StoreKey,
)

tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
// NOTE: The testingkey is just mounted for testing purposes. Actual applications should
// not include this key.
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, fbridgetypes.MemStoreKey, "testingkey")

// configure state listening capabilities using AppOptions
// we are doing nothing with the returned streamingServices and waitGroup in this case
Expand Down Expand Up @@ -460,6 +477,11 @@ func NewLinkApp(
wasmOpts...,
)

fswapConfig := fswaptypes.DefaultConfig()
app.FswapKeeper = fswapkeeper.NewKeeper(appCodec, keys[fswaptypes.StoreKey], fswapConfig, app.BankKeeper)
const FinschiaV4BaseDenom = "cony"
app.FbridgeKeeper = fbridgekeeper.NewKeeper(appCodec, keys[fbridgetypes.StoreKey], memKeys[fbridgetypes.MemStoreKey], app.AccountKeeper, app.BankKeeper, FinschiaV4BaseDenom, fbridgetypes.DefaultAuthority().String())

// register the proposal types
govRouter := govtypes.NewRouter()
govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
Expand All @@ -468,7 +490,8 @@ func NewLinkApp(
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(foundation.RouterKey, foundationkeeper.NewFoundationProposalsHandler(app.FoundationKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
AddRoute(wasmplustypes.RouterKey, wasmpluskeeper.NewWasmProposalHandler(&app.WasmKeeper, wasmplustypes.EnableAllProposals))
AddRoute(wasmplustypes.RouterKey, wasmpluskeeper.NewWasmProposalHandler(&app.WasmKeeper, wasmplustypes.EnableAllProposals)).
AddRoute(fswaptypes.RouterKey, fswap.NewSwapHandler(app.FswapKeeper))

govKeeper := govkeeper.NewKeeper(
appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper,
Expand Down Expand Up @@ -521,6 +544,8 @@ func NewLinkApp(
ibc.NewAppModule(app.IBCKeeper),
transferModule,
icaModule,
fswap.NewAppModule(appCodec, app.FswapKeeper, app.BankKeeper),
fbridgemodule.NewAppModule(appCodec, app.FbridgeKeeper),
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand Down Expand Up @@ -551,6 +576,8 @@ func NewLinkApp(
ibchost.ModuleName,
icatypes.ModuleName,
wasmplustypes.ModuleName,
fswaptypes.ModuleName,
fbridgetypes.ModuleName,
)
app.mm.SetOrderEndBlockers(
crisistypes.ModuleName,
Expand All @@ -576,6 +603,8 @@ func NewLinkApp(
ibchost.ModuleName,
icatypes.ModuleName,
wasmplustypes.ModuleName,
fswaptypes.ModuleName,
fbridgetypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand All @@ -591,6 +620,7 @@ func NewLinkApp(
capabilitytypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
fbridgetypes.ModuleName,
distrtypes.ModuleName,
stakingtypes.ModuleName,
slashingtypes.ModuleName,
Expand All @@ -612,6 +642,7 @@ func NewLinkApp(
icatypes.ModuleName,
// wasm after ibc transfer
wasmplustypes.ModuleName,
fswaptypes.ModuleName,
)

app.mm.RegisterInvariants(&app.CrisisKeeper)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/Finschia/finschia/v3
go 1.20

require (
github.com/Finschia/finschia-sdk v0.48.1
github.com/Finschia/finschia-sdk v0.49.0-rc1
github.com/Finschia/ostracon v1.1.3
github.com/Finschia/wasmd v0.3.0
github.com/cosmos/ibc-go/v4 v4.3.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/Finschia/finschia-sdk v0.48.1 h1:lqO5DOXNVmvYq3/CCSO5g5nn6dLMzGFUHgY8RutoQGA=
github.com/Finschia/finschia-sdk v0.48.1/go.mod h1:bmPv3zWUAWmm+ZxLpUAK3NhURQ4l+3tg3Bw+WcinbmY=
github.com/Finschia/finschia-sdk v0.49.0-rc1 h1:IiNz6KVGjMRDByV7HqUkUYncY/CFdJAFbAfMecalYHA=
github.com/Finschia/finschia-sdk v0.49.0-rc1/go.mod h1:bmPv3zWUAWmm+ZxLpUAK3NhURQ4l+3tg3Bw+WcinbmY=
github.com/Finschia/ibc-go/v4 v4.3.1 h1:pUKry0j+1/ypCC3X1TkEzoLrS1A/low/1PE2HZL+13k=
github.com/Finschia/ibc-go/v4 v4.3.1/go.mod h1:kFZgmXXT2pt9QL7Ngx/eA7lI9JlOMGRG/oU4RTDXKcg=
github.com/Finschia/ostracon v1.1.3 h1:GYPTc8et+sXEq9W2SUlYwvnImpZ4aG8hI2cIhyBWRSU=
Expand Down

0 comments on commit 208930a

Please sign in to comment.