2022-09-15 22:00:32 +00:00
|
|
|
package keeper
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
"github.com/tendermint/tendermint/libs/log"
|
|
|
|
|
|
|
|
"github.com/kava-labs/kava/x/liquid/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Keeper struct for the liquid module.
|
|
|
|
type Keeper struct {
|
|
|
|
cdc codec.Codec
|
|
|
|
|
2022-09-28 20:20:01 +00:00
|
|
|
accountKeeper types.AccountKeeper
|
|
|
|
bankKeeper types.BankKeeper
|
|
|
|
stakingKeeper types.StakingKeeper
|
|
|
|
distributionKeeper types.DistributionKeeper
|
2022-09-15 22:00:32 +00:00
|
|
|
|
|
|
|
derivativeDenom string
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewKeeper returns a new keeper for the liquid module.
|
|
|
|
func NewKeeper(
|
|
|
|
cdc codec.Codec,
|
2022-09-28 20:20:01 +00:00
|
|
|
ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, dk types.DistributionKeeper,
|
2022-09-15 22:00:32 +00:00
|
|
|
derivativeDenom string,
|
|
|
|
) Keeper {
|
|
|
|
|
|
|
|
return Keeper{
|
2022-09-28 20:20:01 +00:00
|
|
|
cdc: cdc,
|
|
|
|
accountKeeper: ak,
|
|
|
|
bankKeeper: bk,
|
|
|
|
stakingKeeper: sk,
|
|
|
|
distributionKeeper: dk,
|
|
|
|
derivativeDenom: derivativeDenom,
|
2022-09-15 22:00:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewDefaultKeeper returns a new keeper for the liquid module with default values.
|
|
|
|
func NewDefaultKeeper(
|
|
|
|
cdc codec.Codec,
|
2022-09-28 20:20:01 +00:00
|
|
|
ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, dk types.DistributionKeeper,
|
2022-09-15 22:00:32 +00:00
|
|
|
) Keeper {
|
|
|
|
|
2022-09-28 20:20:01 +00:00
|
|
|
return NewKeeper(cdc, ak, bk, sk, dk, types.DefaultDerivativeDenom)
|
2022-09-15 22:00:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Logger returns a module-specific logger.
|
|
|
|
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
|
|
|
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
|
|
|
|
}
|