cosmos-sdk/x/staking/keeper/power_reduction.go
atheeshp 9b237c7189
chore(x/staking): audit changes (#16795)
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
2023-07-03 07:14:17 +00:00

20 lines
556 B
Go

package keeper
import (
"context"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// TokensToConsensusPower converts input tokens to potential consensus-engine power
func (k Keeper) TokensToConsensusPower(ctx context.Context, tokens math.Int) int64 {
return sdk.TokensToConsensusPower(tokens, k.PowerReduction(ctx))
}
// TokensFromConsensusPower converts input power to tokens
func (k Keeper) TokensFromConsensusPower(ctx context.Context, power int64) math.Int {
return sdk.TokensFromConsensusPower(power, k.PowerReduction(ctx))
}