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

Added liquidity module #736

Merged
merged 1 commit into from
Apr 26, 2024
Merged
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
6 changes: 3 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res
}

// custom initialization
//var bankGenesisState banktypes.GenesisState
//app.appCodec.MustUnmarshalJSON(genesisState["bank"], &bankGenesisState)
//app.BandwidthMeter.AddToDesirableBandwidth(ctx, bankGenesisState.Supply.AmountOf(ctypes.VOLT).Uint64())
// var bankGenesisState banktypes.GenesisState
// app.appCodec.MustUnmarshalJSON(genesisState["bank"], &bankGenesisState)
// app.BandwidthMeter.AddToDesirableBandwidth(ctx, bankGenesisState.Supply.AmountOf(ctypes.VOLT).Uint64())

app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap())
resp := app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState)
Expand Down
35 changes: 18 additions & 17 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ import (

//"github.com/cybercongress/go-cyber/v4/app"

// liquiditykeeper "github.com/gravity-devs/liquidity/x/liquidity/keeper"
// liquiditytypes "github.com/gravity-devs/liquidity/x/liquidity/types"
"github.com/spf13/cast"

liquiditykeeper "github.com/cybercongress/go-cyber/v4/x/liquidity/keeper"
liquiditytypes "github.com/cybercongress/go-cyber/v4/x/liquidity/types"

wasmplugins "github.com/cybercongress/go-cyber/v4/plugins"
"github.com/cybercongress/go-cyber/v4/x/bandwidth"
bandwidthkeeper "github.com/cybercongress/go-cyber/v4/x/bandwidth/keeper"
Expand Down Expand Up @@ -97,9 +98,9 @@ var maccPerms = map[string][]string{
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcfeetypes.ModuleName: nil,
wasmtypes.ModuleName: {authtypes.Burner},
// liquiditytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
gridtypes.GridPoolName: nil,
resourcestypes.ResourcesName: {authtypes.Minter, authtypes.Burner},
liquiditytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
gridtypes.GridPoolName: nil,
resourcestypes.ResourcesName: {authtypes.Minter, authtypes.Burner},
}

type AppKeepers struct {
Expand Down Expand Up @@ -129,8 +130,8 @@ type AppKeepers struct {

ConsensusParamsKeeper consensusparamkeeper.Keeper

WasmKeeper wasmkeeper.Keeper
// LiquidityKeeper liquiditykeeper.Keeper
WasmKeeper wasmkeeper.Keeper
LiquidityKeeper liquiditykeeper.Keeper
BandwidthMeter *bandwidthkeeper.BandwidthMeter
CyberbankKeeper *cyberbankkeeper.IndexedKeeper
GraphKeeper *graphkeeper.GraphKeeper
Expand Down Expand Up @@ -354,14 +355,14 @@ func NewAppKeepers(
govModAddress,
)

//appKeepers.LiquidityKeeper = liquiditykeeper.NewKeeper(
// appCodec,
// keys[liquiditytypes.StoreKey],
// appKeepers.GetSubspace(liquiditytypes.ModuleName),
// appKeepers.CyberbankKeeper.Proxy,
// appKeepers.AccountKeeper,
// appKeepers.DistrKeeper,
//)
appKeepers.LiquidityKeeper = liquiditykeeper.NewKeeper(
appCodec,
keys[liquiditytypes.StoreKey],
appKeepers.CyberbankKeeper.Proxy,
appKeepers.AccountKeeper,
appKeepers.DistrKeeper,
govModAddress,
)

// End cyber's keepers configuration

Expand Down Expand Up @@ -462,7 +463,7 @@ func NewAppKeepers(
appKeepers.DmnKeeper,
appKeepers.GridKeeper,
appKeepers.BandwidthMeter,
// appKeepers.LiquidityKeeper,
appKeepers.LiquidityKeeper,
)
wasmOpts = append(wasmOpts, cyberOpts...)

Expand Down Expand Up @@ -536,7 +537,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(gridtypes.ModuleName)
paramsKeeper.Subspace(dmntypes.ModuleName)
paramsKeeper.Subspace(resourcestypes.ModuleName)
// paramsKeeper.Subspace(liquiditytypes.ModuleName)
paramsKeeper.Subspace(liquiditytypes.ModuleName)

return paramsKeeper
}
Expand Down
4 changes: 2 additions & 2 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"

// liquiditytypes "github.com/gravity-devs/liquidity/x/liquidity/types"
liquiditytypes "github.com/cybercongress/go-cyber/v4/x/liquidity/types"

bandwidthtypes "github.com/cybercongress/go-cyber/v4/x/bandwidth/types"
dmntypes "github.com/cybercongress/go-cyber/v4/x/dmn/types"
Expand All @@ -48,7 +48,7 @@ func (appKeepers *AppKeepers) GenerateKeys() {
ibcfeetypes.StoreKey,
wasmtypes.StoreKey,
// our additions
// liquiditytypes.StoreKey,
liquiditytypes.StoreKey,
bandwidthtypes.StoreKey,
graphtypes.StoreKey,
ranktypes.StoreKey,
Expand Down
14 changes: 7 additions & 7 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ import (
ibc "github.com/cosmos/ibc-go/v7/modules/core"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"

//"github.com/gravity-devs/liquidity/x/liquidity"
//liquiditytypes "github.com/gravity-devs/liquidity/x/liquidity/types"
"github.com/cybercongress/go-cyber/v4/x/liquidity"
liquiditytypes "github.com/cybercongress/go-cyber/v4/x/liquidity/types"

"github.com/cybercongress/go-cyber/v4/app/params"
"github.com/cybercongress/go-cyber/v4/x/bandwidth"
Expand Down Expand Up @@ -93,7 +93,7 @@ var ModuleBasics = module.NewBasicManager(
ibcfee.AppModuleBasic{},
transfer.AppModuleBasic{},
consensus.AppModuleBasic{},
// liquidity.AppModuleBasic{},
liquidity.AppModuleBasic{},
wasm.AppModuleBasic{},
bandwidth.AppModuleBasic{},
cyberbank.AppModuleBasic{},
Expand Down Expand Up @@ -137,7 +137,7 @@ func appModules(
crisis.NewAppModule(app.AppKeepers.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)),
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.CyberbankKeeper.Proxy, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
consensus.NewAppModule(appCodec, app.AppKeepers.ConsensusParamsKeeper),
// liquidity.NewAppModule(appCodec, app.LiquidityKeeper, app.AccountKeeper, app.CyberbankKeeper.Proxy, app.DistrKeeper),
liquidity.NewAppModule(appCodec, app.LiquidityKeeper, app.AccountKeeper, app.CyberbankKeeper.Proxy, app.DistrKeeper, app.GetSubspace(liquiditytypes.ModuleName)),
cyberbank.NewAppModule(appCodec, app.CyberbankKeeper),
bandwidth.NewAppModule(appCodec, app.AccountKeeper, app.BandwidthMeter, app.GetSubspace(bandwidthtypes.ModuleName)),
graph.NewAppModule(
Expand Down Expand Up @@ -189,7 +189,7 @@ func orderBeginBlockers() []string {
upgradetypes.ModuleName,
capabilitytypes.ModuleName,
stakingtypes.ModuleName,
// liquiditytypes.ModuleName,
liquiditytypes.ModuleName,
distrtypes.ModuleName,
slashingtypes.ModuleName,
minttypes.ModuleName,
Expand Down Expand Up @@ -223,7 +223,7 @@ func orderEndBlockers() []string {
crisistypes.ModuleName,
govtypes.ModuleName,
stakingtypes.ModuleName,
// liquiditytypes.ModuleName,
liquiditytypes.ModuleName,
cyberbanktypes.ModuleName,
bandwidthtypes.ModuleName,
graphtypes.ModuleName,
Expand Down Expand Up @@ -266,7 +266,7 @@ func orderInitBlockers() []string {
ibcexported.ModuleName,
evidencetypes.ModuleName,
consensusparamtypes.ModuleName,
// liquiditytypes.ModuleName,
liquiditytypes.ModuleName,
feegrant.ModuleName,
authz.ModuleName,
authtypes.ModuleName,
Expand Down
1 change: 1 addition & 0 deletions app/upgrades/v4/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
store "github.com/cosmos/cosmos-sdk/store/types"
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"

resourcestypes "github.com/cybercongress/go-cyber/v4/x/resources/types"

"github.com/cybercongress/go-cyber/v4/app/upgrades"
Expand Down
4 changes: 3 additions & 1 deletion app/upgrades/v4/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v3

import (
"fmt"
liquiditytypes "github.com/cybercongress/go-cyber/v4/x/liquidity/types"
"time"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
Expand Down Expand Up @@ -83,8 +84,9 @@ func CreateV4UpgradeHandler(
keyTable = ranktypes.ParamKeyTable() //nolint:staticcheck
case resourcestypes.ModuleName:
keyTable = resourcestypes.ParamKeyTable() //nolint:staticcheck
case liquiditytypes.ModuleName:
keyTable = liquiditytypes.ParamKeyTable()
}

if !subspace.HasKeyTable() {
subspace.WithKeyTable(keyTable)
}
Expand Down
Loading