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

feat: allow depositing vesting tokens in the vault #174

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
26 changes: 23 additions & 3 deletions demo/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/osmosis-labs/mesh-security-sdk/x/meshsecurity"

"github.com/osmosis-labs/mesh-security-sdk/wasmbinding"
meshseckeeper "github.com/osmosis-labs/mesh-security-sdk/x/meshsecurity/keeper"
meshsectypes "github.com/osmosis-labs/mesh-security-sdk/x/meshsecurity/types"
meshsecprov "github.com/osmosis-labs/mesh-security-sdk/x/meshsecurityprovider"
meshsecprovkeeper "github.com/osmosis-labs/mesh-security-sdk/x/meshsecurityprovider/keeper"
meshsecprovtypes "github.com/osmosis-labs/mesh-security-sdk/x/meshsecurityprovider/types"
)

const appName = "MeshApp"
Expand Down Expand Up @@ -200,6 +205,7 @@ var (
ica.AppModuleBasic{},
ibcfee.AppModuleBasic{},
meshsecurity.AppModuleBasic{},
meshsecprov.AppModuleBasic{},
)

// module account permissions
Expand Down Expand Up @@ -263,6 +269,7 @@ type MeshApp struct {
TransferKeeper ibctransferkeeper.Keeper
WasmKeeper wasmkeeper.Keeper
MeshSecKeeper *meshseckeeper.Keeper
MeshSecProvKeeper *meshsecprovkeeper.Keeper

ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -314,6 +321,7 @@ func NewMeshApp(
wasmtypes.StoreKey, icahosttypes.StoreKey,
icacontrollertypes.StoreKey,
meshsectypes.StoreKey,
meshsecprovtypes.StoreKey,
)

tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -417,6 +425,13 @@ func NewMeshApp(
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.MeshSecProvKeeper = meshsecprovkeeper.NewKeeper(
appCodec,
keys[meshsecprovtypes.StoreKey],
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
app.BankKeeper,
)

app.SlashingKeeper = slashingkeeper.NewKeeper(
appCodec,
legacyAmino,
Expand Down Expand Up @@ -585,15 +600,16 @@ func NewMeshApp(
meshMessageHandler := wasmkeeper.WithMessageHandlerDecorator(func(nested wasmkeeper.Messenger) wasmkeeper.Messenger {
return wasmkeeper.NewMessageHandlerChain(
// security layer for system integrity, should always be first in chain
meshseckeeper.NewIntegrityHandler(app.MeshSecKeeper),
wasmbinding.NewIntegrityHandler(app.MeshSecKeeper),
nested,
// append our custom message handler for mesh-security
meshseckeeper.NewDefaultCustomMsgHandler(app.MeshSecKeeper),
wasmbinding.CustomMessageDecorator(app.MeshSecKeeper, app.MeshSecProvKeeper),
)
})

wasmOpts = append(wasmOpts, meshMessageHandler,
// add support for the mesh-security queries
wasmkeeper.WithQueryHandlerDecorator(meshseckeeper.NewQueryDecorator(app.MeshSecKeeper, app.SlashingKeeper)),
wasmkeeper.WithQueryHandlerDecorator(wasmbinding.NewQueryDecorator(app.MeshSecKeeper, app.SlashingKeeper)),
)
// The last arguments can contain custom message handlers, and custom query handlers,
// if we want to allow any custom callbacks
Expand Down Expand Up @@ -694,6 +710,7 @@ func NewMeshApp(
ibcfee.NewAppModule(app.IBCFeeKeeper),
ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper),
meshsecurity.NewAppModule(appCodec, app.MeshSecKeeper),
meshsecprov.NewAppModule(app.MeshSecProvKeeper),
crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them
)

Expand All @@ -715,6 +732,7 @@ func NewMeshApp(
ibcfeetypes.ModuleName,
wasmtypes.ModuleName,
meshsectypes.ModuleName,
meshsecprovtypes.ModuleName,
)

app.ModuleManager.SetOrderEndBlockers(
Expand All @@ -731,6 +749,7 @@ func NewMeshApp(
ibcfeetypes.ModuleName,
wasmtypes.ModuleName,
meshsectypes.ModuleName, // last to capture all chain events
meshsecprovtypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand All @@ -755,6 +774,7 @@ func NewMeshApp(
// wasm after ibc transfer
wasmtypes.ModuleName,
meshsectypes.ModuleName,
meshsecprovtypes.ModuleName,
}
app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...)
app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...)
Expand Down
5 changes: 4 additions & 1 deletion demo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ require (
cosmossdk.io/tools/rosetta v0.2.1
github.com/cometbft/cometbft v0.37.2
github.com/cometbft/cometbft-db v0.8.0
github.com/osmosis-labs/mesh-security-sdk/x v0.0.0-00010101000000-000000000000
github.com/osmosis-labs/mesh-security-sdk/wasmbinding v0.0.0-00010101000000-000000000000
github.com/osmosis-labs/mesh-security-sdk/x v0.0.0-20231230023625-3cdce6e349eb
github.com/spf13/viper v1.16.0
)

Expand Down Expand Up @@ -193,6 +194,8 @@ replace (
// See: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.8.1

github.com/osmosis-labs/mesh-security-sdk/wasmbinding => ../wasmbinding

// local work dir
github.com/osmosis-labs/mesh-security-sdk/x => ../x

Expand Down
Loading
Loading