Skip to content

Commit

Permalink
refactor: util
Browse files Browse the repository at this point in the history
  • Loading branch information
shifty11 committed Mar 26, 2024
1 parent 2841ac5 commit b279b33
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 31 deletions.
30 changes: 30 additions & 0 deletions util/expected_keepers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package util

import (
"context"
upgradeTypes "cosmossdk.io/x/upgrade/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)

type AccountKeeper interface {
GetModuleAddress(string) sdk.AccAddress
}

type BankKeeper interface {
SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error
SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error
SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
}

type DistrKeeper interface {
FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error
}

type DistributionKeeper interface {
FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error
}

type UpgradeKeeper interface {
ScheduleUpgrade(context.Context, upgradeTypes.Plan) error
}
26 changes: 0 additions & 26 deletions util/logic_bank.go
Original file line number Diff line number Diff line change
@@ -1,36 +1,10 @@
package util

import (
"context"
globalTypes "github.com/KYVENetwork/chain/x/global/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)

type BankKeeper interface {
SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
SendCoinsFromModuleToAccount(
ctx context.Context,
senderModule string,
recipientAddr sdk.AccAddress,
amt sdk.Coins,
) error
SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error
SendCoinsFromAccountToModule(
ctx context.Context,
senderAddr sdk.AccAddress,
recipientModule string,
amt sdk.Coins,
) error
}

type DistrKeeper interface {
FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error
}

type AccountKeeper interface {
GetModuleAddress(moduleName string) sdk.AccAddress
}

// TransferFromAddressToAddress sends tokens from the given address to a specified address.
func TransferFromAddressToAddress(
bankKeeper BankKeeper,
Expand Down
5 changes: 0 additions & 5 deletions util/logic_error.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
package util

import (
"context"
"strconv"

upgradeTypes "cosmossdk.io/x/upgrade/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)

type UpgradeKeeper interface {
ScheduleUpgrade(ctx context.Context, plan upgradeTypes.Plan) error
}

// PanicHalt performs an emergency upgrade which immediately halts the chain
// The Team has to come up with a solution and develop a patch to handle
// the update.
Expand Down

0 comments on commit b279b33

Please sign in to comment.