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: distr keeper #183

Closed
wants to merge 6 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
13 changes: 7 additions & 6 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
package ante

import (
"github.com/cosmos/cosmos-sdk/client"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
"github.com/skip-mev/pob/mempool"
Expand All @@ -15,6 +9,13 @@ import (
feeshareante "github.com/terra-money/core/v2/x/feeshare/ante"
feesharekeeper "github.com/terra-money/core/v2/x/feeshare/keeper"

"github.com/cosmos/cosmos-sdk/client"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
)
Expand Down
11 changes: 6 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import (
feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
customdistrkeeper "github.com/terra-money/core/v2/custom/distribution/keeper"

"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
Expand Down Expand Up @@ -325,7 +326,7 @@ type TerraApp struct {
StakingKeeper *stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
MintKeeper mintkeeper.Keeper
DistrKeeper distrkeeper.Keeper
DistrKeeper customdistrkeeper.Keeper
GovKeeper govkeeper.Keeper
CrisisKeeper crisiskeeper.Keeper
UpgradeKeeper *upgradekeeper.Keeper
Expand Down Expand Up @@ -485,7 +486,7 @@ func NewTerraApp(
authtypes.FeeCollectorName,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
app.DistrKeeper = distrkeeper.NewKeeper(
app.DistrKeeper = customdistrkeeper.NewKeeper(
appCodec,
keys[distrtypes.StoreKey],
app.AccountKeeper,
Expand Down Expand Up @@ -667,7 +668,7 @@ func NewTerraApp(
app.AccountKeeper,
app.BankKeeper,
app.StakingKeeper,
distrkeeper.NewQuerier(app.DistrKeeper),
distrkeeper.NewQuerier(app.DistrKeeper.Keeper),
app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
Expand Down Expand Up @@ -769,7 +770,7 @@ func NewTerraApp(
gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)),
distr.NewAppModule(appCodec, app.DistrKeeper.Keeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)),
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
upgrade.NewAppModule(app.UpgradeKeeper),
Expand Down Expand Up @@ -1339,7 +1340,7 @@ func (app *TerraApp) SimulationManager() *module.SimulationManager {
gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)),
distr.NewAppModule(appCodec, app.DistrKeeper.Keeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(stakingtypes.ModuleName)),
params.NewAppModule(app.ParamsKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
Expand Down
16 changes: 9 additions & 7 deletions app/app_test/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
mocktestutils "github.com/cosmos/cosmos-sdk/testutil/mock"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
Expand All @@ -19,7 +17,16 @@ import (
"github.com/terra-money/core/v2/x/feeshare"
"github.com/terra-money/core/v2/x/tokenfactory"

mocktestutils "github.com/cosmos/cosmos-sdk/testutil/mock"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"

tmtypes "github.com/cometbft/cometbft/types"
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router"
ibchooks "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7"
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
"github.com/cosmos/ibc-go/v7/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/v7/modules/core"

"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand All @@ -44,11 +51,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/upgrade"
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router"
ibchooks "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7"
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
"github.com/cosmos/ibc-go/v7/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/v7/modules/core"

"github.com/CosmWasm/wasmd/x/wasm"
terra_app "github.com/terra-money/core/v2/app"
Expand Down
18 changes: 9 additions & 9 deletions app/app_test/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ import (
"github.com/cometbft/cometbft/libs/log"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmtypes "github.com/cometbft/cometbft/types"
"github.com/stretchr/testify/suite"
"github.com/terra-money/core/v2/app"
terra_app "github.com/terra-money/core/v2/app"
"github.com/terra-money/core/v2/app/config"
appparams "github.com/terra-money/core/v2/app/params"
"github.com/terra-money/core/v2/app/wasmconfig"
feesharetypes "github.com/terra-money/core/v2/x/feeshare/types"
tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types"

"github.com/cosmos/cosmos-sdk/baseapp"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
Expand All @@ -23,14 +32,6 @@ import (
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/suite"
"github.com/terra-money/core/v2/app"
terra_app "github.com/terra-money/core/v2/app"
"github.com/terra-money/core/v2/app/config"
appparams "github.com/terra-money/core/v2/app/params"
"github.com/terra-money/core/v2/app/wasmconfig"
feesharetypes "github.com/terra-money/core/v2/x/feeshare/types"
tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types"
)

type AppTestSuite struct {
Expand Down Expand Up @@ -114,7 +115,6 @@ func (s *AppTestSuite) CreateRandomAccounts(numAccts int) []sdk.AccAddress {

// FundAcc funds target address with specified amount.
func (s *AppTestSuite) FundAcc(acc sdk.AccAddress, amounts sdk.Coins) (err error) {
s.Require().NoError(err)
if err := s.App.BankKeeper.MintCoins(s.Ctx, minttypes.ModuleName, amounts); err != nil {
return err
}
Expand Down
15 changes: 8 additions & 7 deletions app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ package app
import (
"encoding/json"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
icagenesistypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
buildertypes "github.com/skip-mev/pob/x/builder/types"
"github.com/terra-money/core/v2/app/config"
tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)

// GenesisState - The genesis state of the blockchain is represented here as a map of raw json
Expand Down
3 changes: 2 additions & 1 deletion app/params/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package params

import (
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/terra-money/core/v2/app/config"

sdk "github.com/cosmos/cosmos-sdk/types"
)

func RegisterAddressesConfig() *sdk.Config {
Expand Down
3 changes: 2 additions & 1 deletion app/params/denoms.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package params

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/terra-money/core/v2/app/config"

sdk "github.com/cosmos/cosmos-sdk/types"
)

func RegisterDenomsConfig() error {
Expand Down
6 changes: 4 additions & 2 deletions app/rpc/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package rpc

import (
"context"
"net/http"

ctypes "github.com/cometbft/cometbft/rpc/core/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/gorilla/mux"
"net/http"

"github.com/cosmos/cosmos-sdk/client"
)

type HealthcheckResponse struct {
Expand Down
7 changes: 4 additions & 3 deletions app/upgrades/v2.3.0/upgrade.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package v2_3_0

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
"github.com/terra-money/core/v2/app/config"
tokenfactorykeeper "github.com/terra-money/core/v2/x/tokenfactory/keeper"
tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

func CreateUpgradeHandler(
Expand Down
19 changes: 11 additions & 8 deletions app/upgrades/v2.5/upgrade.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
package v2_5

import (
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
"time"

pobkeeper "github.com/skip-mev/pob/x/builder/keeper"
pobtypes "github.com/skip-mev/pob/x/builder/types"
"time"

authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"

sdkerrors "cosmossdk.io/errors"
icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper"
ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -15,12 +24,6 @@ import (
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper"
ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
)

func CreateUpgradeHandler(
Expand Down
13 changes: 7 additions & 6 deletions app/upgrades/v2.6/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ import (
"time"

sdkerrors "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper"
ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
pobtypes "github.com/skip-mev/pob/x/builder/types"
feesharekeeper "github.com/terra-money/core/v2/x/feeshare/keeper"
feesharetypes "github.com/terra-money/core/v2/x/feeshare/types"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

func CreateUpgradeHandler(
Expand Down
1 change: 1 addition & 0 deletions app/wasmconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/spf13/cobra"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

servertypes "github.com/cosmos/cosmos-sdk/server/types"
)

Expand Down
1 change: 1 addition & 0 deletions cmd/terrad/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/spf13/viper"

tmcfg "github.com/cometbft/cometbft/config"

"github.com/cosmos/cosmos-sdk/client"

"github.com/cosmos/cosmos-sdk/client/config"
Expand Down
3 changes: 2 additions & 1 deletion custom/bank/keeper/hooks.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package keeper

import (
sdk "github.com/cosmos/cosmos-sdk/types"
customterratypes "github.com/terra-money/core/v2/custom/bank/types"

sdk "github.com/cosmos/cosmos-sdk/types"
)

// Implements StakingHooks interface
Expand Down
3 changes: 2 additions & 1 deletion custom/bank/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
accountkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"

sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
custombankkeeper "github.com/terra-money/alliance/custom/bank/keeper"
customterratypes "github.com/terra-money/core/v2/custom/bank/types"

sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

type Keeper struct {
Expand Down
5 changes: 3 additions & 2 deletions custom/bank/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"github.com/cosmos/cosmos-sdk/x/bank/exported"
"github.com/cosmos/cosmos-sdk/x/bank/types"

"github.com/cosmos/cosmos-sdk/types/module"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
customalliancemod "github.com/terra-money/alliance/custom/bank"
custombankkeeper "github.com/terra-money/core/v2/custom/bank/keeper"

"github.com/cosmos/cosmos-sdk/types/module"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
)

// AppModule wraps around the bank module and the bank keeper to return the right total supply ignoring bonded tokens
Expand Down
Loading
Loading