mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-14 20:15:18 +00:00
6ef9bab67d
* wip Add claim * Add distr keeper and claiming * Add claim test * Update claim test with failures * wip Add staking rewards * -S Fix savings to earn incentive methods * Use a single accural time for all earn incentives * Add additional required liquid methods * Update genesis to only include 1 accrual time for earn * Revert "Update genesis to only include 1 accrual time for earn" This reverts commit cc7e35347298681c0c8a4a0b9bf9b9b296c25531. * Revert "Use a single accural time for all earn incentives" This reverts commit aeb49c4622d4e3d99dc6421c8830932b1b546be9. * Update tests with incentive distribution * Add earn to incentive rewards query * add earn cli tx * Update claim example to use ukava large * Use underlying ukava to determine proportional reward amount * Rename liquid methods to reflect derivative value * Add tests for derivative values * Return error to panic in BeginBlocker Co-authored-by: karzak <kjydavis3@gmail.com>
55 lines
1.3 KiB
Go
55 lines
1.3 KiB
Go
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
|
|
|
|
accountKeeper types.AccountKeeper
|
|
bankKeeper types.BankKeeper
|
|
stakingKeeper types.StakingKeeper
|
|
distributionKeeper types.DistributionKeeper
|
|
|
|
derivativeDenom string
|
|
}
|
|
|
|
// NewKeeper returns a new keeper for the liquid module.
|
|
func NewKeeper(
|
|
cdc codec.Codec,
|
|
ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, dk types.DistributionKeeper,
|
|
derivativeDenom string,
|
|
) Keeper {
|
|
|
|
return Keeper{
|
|
cdc: cdc,
|
|
accountKeeper: ak,
|
|
bankKeeper: bk,
|
|
stakingKeeper: sk,
|
|
distributionKeeper: dk,
|
|
derivativeDenom: derivativeDenom,
|
|
}
|
|
}
|
|
|
|
// NewDefaultKeeper returns a new keeper for the liquid module with default values.
|
|
func NewDefaultKeeper(
|
|
cdc codec.Codec,
|
|
ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, dk types.DistributionKeeper,
|
|
) Keeper {
|
|
|
|
return NewKeeper(cdc, ak, bk, sk, dk, types.DefaultDerivativeDenom)
|
|
}
|
|
|
|
// 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))
|
|
}
|