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

alliance sdk50 support #56

Merged
merged 2 commits into from
Feb 21, 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
114 changes: 58 additions & 56 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ import (
"github.com/cosmos/cosmos-sdk/x/authz"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
bank "github.com/cosmos/cosmos-sdk/x/bank"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"

// bank "github.com/cosmos/cosmos-sdk/x/bank"
// bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/consensus"
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
Expand Down Expand Up @@ -90,12 +91,11 @@ import (
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
ibctestingtypes "github.com/cosmos/ibc-go/v8/testing/types"

// bank "github.com/terra-money/alliance/custom/bank"
// bankkeeper "github.com/terra-money/alliance/custom/bank/keeper"
// alliancemodule "github.com/terra-money/alliance/x/alliance"
// alliancemoduleclient "github.com/terra-money/alliance/x/alliance/client"
// alliancemodulekeeper "github.com/terra-money/alliance/x/alliance/keeper"
// alliancemoduletypes "github.com/terra-money/alliance/x/alliance/types"
bank "github.com/terra-money/alliance/custom/bank"
bankkeeper "github.com/terra-money/alliance/custom/bank/keeper"
alliancemodule "github.com/terra-money/alliance/x/alliance"
alliancemodulekeeper "github.com/terra-money/alliance/x/alliance/keeper"
alliancemoduletypes "github.com/terra-money/alliance/x/alliance/types"

"cosmossdk.io/x/upgrade"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
Expand Down Expand Up @@ -173,23 +173,23 @@ var (

// module account permissions
maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcfeetypes.ModuleName: nil,
icatypes.ModuleName: nil,
wasmtypes.ModuleName: {authtypes.Burner},
denomtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
batchtypes.ModuleName: nil,
schedulertypes.ModuleName: nil,
oracletypes.ModuleName: nil,
// alliancemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner},
// alliancemoduletypes.RewardsPoolName: nil,
cwicatypes.ModuleName: nil,
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcfeetypes.ModuleName: nil,
icatypes.ModuleName: nil,
wasmtypes.ModuleName: {authtypes.Burner},
denomtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
batchtypes.ModuleName: nil,
schedulertypes.ModuleName: nil,
oracletypes.ModuleName: nil,
alliancemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner},
alliancemoduletypes.RewardsPoolName: nil,
cwicatypes.ModuleName: nil,
}
)

Expand Down Expand Up @@ -251,7 +251,7 @@ type App struct {
SchedulerKeeper schedulerkeeper.Keeper
OracleKeeper oraclekeeper.Keeper
CwICAKeeper cwicakeeper.Keeper
// AllianceKeeper alliancemodulekeeper.Keeper
AllianceKeeper alliancemodulekeeper.Keeper

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -368,7 +368,7 @@ func New(
schedulertypes.StoreKey,
oracletypes.StoreKey,
batchtypes.StoreKey,
// AllianceStoreKey,
AllianceStoreKey,
cwicatypes.StoreKey,
)

Expand Down Expand Up @@ -473,18 +473,18 @@ func New(
authority,
)

// app.AllianceKeeper = alliancemodulekeeper.NewKeeper(
// appCodec,
// keys[AllianceStoreKey],
// app.AccountKeeper,
// app.BankKeeper,
// app.StakingKeeper,
// app.DistrKeeper,
// authtypes.FeeCollectorName,
// authority,
// )
app.AllianceKeeper = alliancemodulekeeper.NewKeeper(
appCodec,
runtime.NewKVStoreService(keys[AllianceStoreKey]),
app.AccountKeeper,
app.BankKeeper,
app.StakingKeeper,
app.DistrKeeper,
authtypes.FeeCollectorName,
authority,
)

// app.BankKeeper.RegisterKeepers(app.AllianceKeeper, app.StakingKeeper)
app.BankKeeper.RegisterKeepers(app.AllianceKeeper, app.StakingKeeper)

app.SlashingKeeper = slashingkeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -528,8 +528,10 @@ func New(

// register the staking hooks
app.StakingKeeper.SetHooks(
stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), // app.AllianceKeeper.StakingHooks(),

stakingtypes.NewMultiStakingHooks(
app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks(),
app.AllianceKeeper.StakingHooks(),
),
)

// ... other modules keepers
Expand Down Expand Up @@ -699,8 +701,8 @@ func New(
// See: https://docs.cosmos.network/main/modules/gov#proposal-messages
govRouter := govtypesv1beta1.NewRouter()
govRouter.AddRoute(govtypes.RouterKey, govtypesv1beta1.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper))
// AddRoute(alliancemoduletypes.RouterKey, alliancemodule.NewAllianceProposalHandler(app.AllianceKeeper))
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(alliancemoduletypes.RouterKey, alliancemodule.NewAllianceProposalHandler(app.AllianceKeeper))

// Create evidence Keeper for to register the IBC light client misbehaviour evidence route
evidenceKeeper := evidencekeeper.NewKeeper(
Expand Down Expand Up @@ -924,15 +926,15 @@ func New(
app.BankKeeper,
),

// alliancemodule.NewAppModule(
// appCodec,
// app.AllianceKeeper,
// app.StakingKeeper,
// app.AccountKeeper,
// app.BankKeeper,
// app.interfaceRegistry,
// app.GetSubspace(alliancemoduletypes.ModuleName),
// ),
alliancemodule.NewAppModule(
appCodec,
app.AllianceKeeper,
app.StakingKeeper,
app.AccountKeeper,
app.BankKeeper,
app.interfaceRegistry,
app.GetSubspace(alliancemoduletypes.ModuleName),
),

cwica.NewAppModule(appCodec, app.CwICAKeeper),

Expand Down Expand Up @@ -996,7 +998,7 @@ func New(
schedulertypes.ModuleName,
oracletypes.ModuleName,
cwicatypes.ModuleName,
// alliancemoduletypes.ModuleName,
alliancemoduletypes.ModuleName,
)

app.ModuleManager.SetOrderEndBlockers(
Expand Down Expand Up @@ -1028,7 +1030,7 @@ func New(
schedulertypes.ModuleName,
oracletypes.ModuleName,
cwicatypes.ModuleName,
// alliancemoduletypes.ModuleName,
alliancemoduletypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -1065,7 +1067,7 @@ func New(
batchtypes.ModuleName,
schedulertypes.ModuleName,
oracletypes.ModuleName,
// alliancemoduletypes.ModuleName,
alliancemoduletypes.ModuleName,
wasmtypes.ModuleName,
cwicatypes.ModuleName,
)
Expand Down Expand Up @@ -1188,7 +1190,7 @@ func BlockedAddresses() map[string]bool {

// allow the following addresses to receive funds
delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String())
// delete(modAccAddrs, authtypes.NewModuleAddress(alliancemoduletypes.ModuleName).String())
delete(modAccAddrs, authtypes.NewModuleAddress(alliancemoduletypes.ModuleName).String())
delete(modAccAddrs, authtypes.NewModuleAddress(authtypes.FeeCollectorName).String())

return modAccAddrs
Expand Down Expand Up @@ -1411,7 +1413,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(schedulertypes.ModuleName)
paramsKeeper.Subspace(oracletypes.ModuleName)
paramsKeeper.Subspace(batchtypes.ModuleName)
// paramsKeeper.Subspace(alliancemoduletypes.ModuleName)
paramsKeeper.Subspace(alliancemoduletypes.ModuleName)

return paramsKeeper
}
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/spf13/cast v1.5.1
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.8.4
// github.com/terra-money/alliance v0.3.2
github.com/terra-money/alliance v0.3.4-0.20240219082352-93675c5a81f3
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f
google.golang.org/grpc v1.60.1
gopkg.in/yaml.v2 v2.4.0
Expand All @@ -45,7 +45,7 @@ require (
cosmossdk.io/x/upgrade v0.1.0
github.com/cosmos/cosmos-db v1.0.0
github.com/cosmos/ibc-go/modules/capability v1.0.0
github.com/hashicorp/go-metrics v0.5.1
github.com/hashicorp/go-metrics v0.5.2
)

require (
Expand Down Expand Up @@ -123,7 +123,7 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.7.1 // indirect
github.com/hashicorp/go-getter v1.7.3 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-plugin v1.5.2 // indirect
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -662,15 +662,15 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY=
github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744=
github.com/hashicorp/go-getter v1.7.3 h1:bN2+Fw9XPFvOCjB0UOevFIMICZ7G2XSQHzfvLUyOM5E=
github.com/hashicorp/go-getter v1.7.3/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744=
github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c=
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-metrics v0.5.1 h1:rfPwUqFU6uZXNvGl4hzjY8LEBsqFVU4si1H9/Hqck/U=
github.com/hashicorp/go-metrics v0.5.1/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE=
github.com/hashicorp/go-metrics v0.5.2 h1:ErEYO2f//CjKsUDw4SmLzelsK6L3ZmOAR/4P9iS7ruY=
github.com/hashicorp/go-metrics v0.5.2/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y=
Expand Down Expand Up @@ -1024,6 +1024,8 @@ github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E=
github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME=
github.com/terra-money/alliance v0.3.4-0.20240219082352-93675c5a81f3 h1:xFwEQVkpeJQvdhkcd9m77Ey5S/OnQodT1b5E9GYXXvM=
github.com/terra-money/alliance v0.3.4-0.20240219082352-93675c5a81f3/go.mod h1:JEvSCfNEqepLIsvLYuaD2+XrT5hP26Bpqg8qbtaW5Bc=
github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI=
github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
Expand Down
Loading