keeper

package
v2.2.0-rc6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 41 Imported by: 6

Documentation

Index

Constants

View Source
const (
	Validator                 = "validator"
	Delegation                = "validator-delegation"
	RewardAccountBalances     = "reward-balances"
	DelegationAccountBalances = "delegation-balances"
)

Variables

This section is empty.

Functions

func CValueLimits

func CValueLimits(k Keeper) sdk.Invariant

func DelegationAccountBalanceCallback

func DelegationAccountBalanceCallback(k Keeper, ctx sdk.Context, data []byte, query icqtypes.Query) error

func DelegationCallback

func DelegationCallback(k Keeper, ctx sdk.Context, data []byte, query icqtypes.Query) error

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the liquidstakeibc MsgServer interface for the provided Keeper.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers the bank module invariants

func RewardsAccountBalanceCallback

func RewardsAccountBalanceCallback(k Keeper, ctx sdk.Context, data []byte, query icqtypes.Query) error

func ValidatorCallback

func ValidatorCallback(k Keeper, ctx sdk.Context, data []byte, query icqtypes.Query) error

Types

type CallbackFn

type CallbackFn func(Keeper, sdk.Context, []byte, icqtypes.Query) error

type Callbacks

type Callbacks struct {
	// contains filtered or unexported fields
}

func (Callbacks) AddCallback

func (c Callbacks) AddCallback(id string, fn interface{}) icqtypes.QueryCallbacks

func (Callbacks) Call

func (c Callbacks) Call(ctx sdk.Context, id string, args []byte, query icqtypes.Query) error

func (Callbacks) Has

func (c Callbacks) Has(id string) bool

func (Callbacks) RegisterCallbacks

func (c Callbacks) RegisterCallbacks() icqtypes.QueryCallbacks

type DelegateAmount

type DelegateAmount struct {
	ValAddress string
	ValWeight  sdk.Dec
	Amount     sdk.Dec
}

type EpochsHooks

type EpochsHooks struct {
	// contains filtered or unexported fields
}

func (EpochsHooks) AfterEpochEnd

func (h EpochsHooks) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) error

func (EpochsHooks) BeforeEpochStart

func (h EpochsHooks) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64) error

type IBCTransferHooks

type IBCTransferHooks struct {
	// contains filtered or unexported fields
}

func (IBCTransferHooks) OnAcknowledgementPacket

func (i IBCTransferHooks) OnAcknowledgementPacket(
	ctx sdk.Context,
	packet channeltypes.Packet,
	acknowledgement []byte,
	relayer sdk.AccAddress,
	transferAckErr error,
) error

func (IBCTransferHooks) OnRecvPacket

func (i IBCTransferHooks) OnRecvPacket(
	ctx sdk.Context,
	packet channeltypes.Packet,
	relayer sdk.AccAddress,
	transferAck ibcexported.Acknowledgement,
) error

func (IBCTransferHooks) OnTimeoutPacket

func (i IBCTransferHooks) OnTimeoutPacket(
	ctx sdk.Context,
	packet channeltypes.Packet,
	relayer sdk.AccAddress,
	transferTimeoutErr error,
) error

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey storetypes.StoreKey,

	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	epochsKeeper types.EpochsKeeper,
	icaControllerKeeper types.ICAControllerKeeper,
	ibcKeeper *ibckeeper.Keeper,
	icqKeeper types.ICQKeeper,

	paramSpace paramtypes.Subspace,

	msgRouter *baseapp.MsgServiceRouter,

	authority string,
) Keeper

func (*Keeper) AdjustDepositsForRedemption

func (k *Keeper) AdjustDepositsForRedemption(
	ctx sdk.Context,
	hc *liquidstakeibctypes.HostChain,
	redeemableAmount sdk.Coin,
) error

func (*Keeper) AfterEpochEnd

func (k *Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) error

func (*Keeper) BeforeEpochStart

func (k *Keeper) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64) error

func (*Keeper) BeginBlock

func (k *Keeper) BeginBlock(ctx sdk.Context)

func (*Keeper) CValueWithinLimits

func (k *Keeper) CValueWithinLimits(ctx sdk.Context, hc *types.HostChain) bool

func (*Keeper) CalculateAutocompoundLimit

func (k *Keeper) CalculateAutocompoundLimit(autocompoundFactor sdk.Dec) sdk.Dec

func (*Keeper) CallbackHandler

func (k *Keeper) CallbackHandler() Callbacks

func (*Keeper) CreateDeposits

func (k *Keeper) CreateDeposits(ctx sdk.Context, epoch int64)

func (*Keeper) DeleteDeposit

func (k *Keeper) DeleteDeposit(ctx sdk.Context, deposit *liquidstakeibctypes.Deposit)

func (*Keeper) DeleteUnbonding

func (k *Keeper) DeleteUnbonding(ctx sdk.Context, ub *types.Unbonding)

func (*Keeper) DeleteUserUnbonding

func (k *Keeper) DeleteUserUnbonding(ctx sdk.Context, ub *types.UserUnbonding)

func (*Keeper) DeleteValidatorUnbonding

func (k *Keeper) DeleteValidatorUnbonding(ctx sdk.Context, ub *types.ValidatorUnbonding)

func (*Keeper) DeleteValidatorUnbondingsForSequenceID

func (k *Keeper) DeleteValidatorUnbondingsForSequenceID(ctx sdk.Context, sequenceID string)

func (*Keeper) DepositWorkflow

func (k *Keeper) DepositWorkflow(ctx sdk.Context, epoch int64)

func (*Keeper) Deposits

func (k *Keeper) Deposits(
	goCtx context.Context,
	request *types.QueryDepositsRequest,
) (*types.QueryDepositsResponse, error)

func (*Keeper) DoClaim

func (k *Keeper) DoClaim(ctx sdk.Context, hc *types.HostChain)

func (*Keeper) DoDelegate

func (k *Keeper) DoDelegate(ctx sdk.Context, hc *types.HostChain)

func (*Keeper) DoProcessMaturedUndelegations

func (k *Keeper) DoProcessMaturedUndelegations(ctx sdk.Context, hc *types.HostChain)

func (*Keeper) DoRecreateICA

func (k *Keeper) DoRecreateICA(ctx sdk.Context, hc *types.HostChain)

func (*Keeper) ExchangeRate

func (k *Keeper) ExchangeRate(
	goCtx context.Context,
	request *types.QueryExchangeRateRequest,
) (*types.QueryExchangeRateResponse, error)

func (*Keeper) FailAllUnbondingsForSequenceID

func (k *Keeper) FailAllUnbondingsForSequenceID(ctx sdk.Context, sequenceID string)

func (*Keeper) FilterUnbondings

func (k *Keeper) FilterUnbondings(ctx sdk.Context, filter func(u types.Unbonding) bool) []*types.Unbonding

func (*Keeper) FilterUserUnbondings

func (k *Keeper) FilterUserUnbondings(ctx sdk.Context, filter func(u types.UserUnbonding) bool) []*types.UserUnbonding

func (*Keeper) FilterValidatorUnbondings

func (k *Keeper) FilterValidatorUnbondings(
	ctx sdk.Context,
	filter func(u types.ValidatorUnbonding) bool,
) []*types.ValidatorUnbonding

func (*Keeper) GenerateAndExecuteICATx

func (k *Keeper) GenerateAndExecuteICATx(
	ctx sdk.Context,
	connectionID string,
	ownerID string,
	messages []proto.Message,
) (string, error)

func (*Keeper) GenerateDelegateMessages

func (k *Keeper) GenerateDelegateMessages(hc *types.HostChain, depositAmount math.Int) ([]proto.Message, error)

func (*Keeper) GenerateUndelegateMessages

func (k *Keeper) GenerateUndelegateMessages(hc *types.HostChain, unbondAmount math.Int) ([]proto.Message, error)

func (*Keeper) GetAllDeposits

func (k *Keeper) GetAllDeposits(ctx sdk.Context) []*liquidstakeibctypes.Deposit

func (*Keeper) GetAllHostChains

func (k *Keeper) GetAllHostChains(ctx sdk.Context) []*types.HostChain

GetAllHostChains retrieves all registered host chains

func (*Keeper) GetAllValidatorUnbondedAmount

func (k *Keeper) GetAllValidatorUnbondedAmount(ctx sdk.Context, hc *types.HostChain) math.Int

func (*Keeper) GetChainID

func (k *Keeper) GetChainID(ctx sdk.Context, connectionID string) (string, error)

GetChainID gets the id of the host chain given a connection id

func (*Keeper) GetClientState

func (k *Keeper) GetClientState(ctx sdk.Context, connectionID string) (exported.ClientState, error)

GetClientState retrieves the client state given a connection id

func (*Keeper) GetDelegableDepositsForChain

func (k *Keeper) GetDelegableDepositsForChain(ctx sdk.Context, chainID string) []*liquidstakeibctypes.Deposit

func (*Keeper) GetDelegatingDepositsForChain

func (k *Keeper) GetDelegatingDepositsForChain(ctx sdk.Context, chainID string) []*liquidstakeibctypes.Deposit

func (*Keeper) GetDepositAmountOnHostChain

func (k *Keeper) GetDepositAmountOnHostChain(ctx sdk.Context, chainID string) math.Int

func (*Keeper) GetDepositAmountOnPersistence

func (k *Keeper) GetDepositAmountOnPersistence(ctx sdk.Context, chainID string) math.Int

func (*Keeper) GetDepositForChainAndEpoch

func (k *Keeper) GetDepositForChainAndEpoch(
	ctx sdk.Context,
	chainID string,
	epoch int64,
) (*liquidstakeibctypes.Deposit, bool)

func (*Keeper) GetDepositModuleAccount

func (k *Keeper) GetDepositModuleAccount(ctx sdk.Context) authtypes.ModuleAccountI

GetDepositModuleAccount returns deposit module account interface

func (*Keeper) GetDepositsForHostChain

func (k *Keeper) GetDepositsForHostChain(ctx sdk.Context, chainID string) []*liquidstakeibctypes.Deposit

func (*Keeper) GetDepositsWithSequenceID

func (k *Keeper) GetDepositsWithSequenceID(ctx sdk.Context, sequenceID string) []*liquidstakeibctypes.Deposit

func (*Keeper) GetEpochNumber

func (k *Keeper) GetEpochNumber(ctx sdk.Context, epoch string) int64

func (*Keeper) GetHostChain

func (k *Keeper) GetHostChain(ctx sdk.Context, chainID string) (*types.HostChain, bool)

GetHostChain returns a host chain given its id

func (*Keeper) GetHostChainFromDelegatorAddress

func (k *Keeper) GetHostChainFromDelegatorAddress(ctx sdk.Context, delegatorAddress string) (*types.HostChain, bool)

GetHostChainFromDelegatorAddress returns a host chain given its delegator address

func (*Keeper) GetHostChainFromHostDenom

func (k *Keeper) GetHostChainFromHostDenom(ctx sdk.Context, hostDenom string) (*types.HostChain, bool)

GetHostChainFromHostDenom returns a host chain given its host denomination

func (*Keeper) GetHostChainFromIbcDenom

func (k *Keeper) GetHostChainFromIbcDenom(ctx sdk.Context, ibcDenom string) (*types.HostChain, bool)

GetHostChainFromIbcDenom returns a host chain given its ibc denomination on Persistence

func (*Keeper) GetParams

func (k *Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams gets the total set of liquidstakeibc parameters.

func (*Keeper) GetPendingDepositsBeforeEpoch

func (k *Keeper) GetPendingDepositsBeforeEpoch(ctx sdk.Context, epoch int64) []*liquidstakeibctypes.Deposit

func (*Keeper) GetPortID

func (k *Keeper) GetPortID(owner string) string

GetPortID constructs a port id given the port owner

func (*Keeper) GetRedeemableDepositsForHostChain

func (k *Keeper) GetRedeemableDepositsForHostChain(
	ctx sdk.Context,
	hc *liquidstakeibctypes.HostChain,
) ([]*liquidstakeibctypes.Deposit, math.Int)

func (*Keeper) GetTransactionSequenceID

func (k *Keeper) GetTransactionSequenceID(channelID string, sequence uint64) string

func (*Keeper) GetUnbonding

func (k *Keeper) GetUnbonding(ctx sdk.Context, chainID string, epochNumber int64) (*types.Unbonding, bool)

func (*Keeper) GetUndelegationModuleAccount

func (k *Keeper) GetUndelegationModuleAccount(ctx sdk.Context) authtypes.ModuleAccountI

GetUndelegationModuleAccount returns undelegation module account interface

func (*Keeper) GetUserUnbonding

func (k *Keeper) GetUserUnbonding(
	ctx sdk.Context,
	chainID string,
	delegatorAddress string,
	epochNumber int64,
) (*types.UserUnbonding, bool)

func (*Keeper) GetValidatorUnbonding

func (k *Keeper) GetValidatorUnbonding(
	ctx sdk.Context,
	chainID string,
	validatorAddress string,
	epochNumber int64,
) (*types.ValidatorUnbonding, bool)

func (*Keeper) HandleDelegateResponse

func (k *Keeper) HandleDelegateResponse(ctx sdk.Context, msg sdk.Msg, channel string, sequence uint64) error

func (*Keeper) HandleMsgTransfer

func (k *Keeper) HandleMsgTransfer(
	ctx sdk.Context,
	msg sdk.Msg,
	resp ibctransfertypes.MsgTransferResponse,
	channel string,
	sequence uint64,
) error

func (*Keeper) HandleUndelegateResponse

func (k *Keeper) HandleUndelegateResponse(
	ctx sdk.Context,
	msg sdk.Msg,
	resp stakingtypes.MsgUndelegateResponse,
	channel string,
	sequence uint64,
) error

func (*Keeper) HostChain

func (k *Keeper) HostChain(
	goCtx context.Context,
	request *types.QueryHostChainRequest,
) (*types.QueryHostChainResponse, error)

func (*Keeper) HostChains

func (k *Keeper) HostChains(
	goCtx context.Context,
	request *types.QueryHostChainsRequest,
) (*types.QueryHostChainsResponse, error)

func (*Keeper) IncreaseUndelegatingAmountForEpoch

func (k *Keeper) IncreaseUndelegatingAmountForEpoch(
	ctx sdk.Context,
	chainID string,
	epochNumber int64,
	burnAmount sdk.Coin,
	unbondAmount sdk.Coin,
)

func (*Keeper) IncreaseUserUnbondingAmountForEpoch

func (k *Keeper) IncreaseUserUnbondingAmountForEpoch(
	ctx sdk.Context,
	chainID string,
	delegatorAddress string,
	epochNumber int64,
	stkAmount sdk.Coin,
	unbondAmount sdk.Coin,
)

func (*Keeper) IsICAChannelActive

func (k *Keeper) IsICAChannelActive(ctx sdk.Context, hc *types.HostChain, portID string) bool

IsICAChannelActive checks if an ICA channel is active

func (*Keeper) Logger

func (k *Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (*Keeper) NewEpochHooks

func (k *Keeper) NewEpochHooks() EpochsHooks

func (*Keeper) NewIBCTransferHooks

func (k *Keeper) NewIBCTransferHooks() IBCTransferHooks

func (*Keeper) OnAcknowledgementIBCTransferPacket

func (k *Keeper) OnAcknowledgementIBCTransferPacket(
	ctx sdk.Context,
	packet channeltypes.Packet,
	acknowledgement []byte,
	relayer sdk.AccAddress,
	transferAckErr error,
) error

func (*Keeper) OnAcknowledgementPacket

func (k *Keeper) OnAcknowledgementPacket(
	ctx sdk.Context,
	packet channeltypes.Packet,
	acknowledgement []byte,
	relayer sdk.AccAddress,
) error

func (*Keeper) OnChanOpenAck

func (k *Keeper) OnChanOpenAck(
	ctx sdk.Context,
	portID string,
	channelID string,
	counterpartyChannelID string,
	counterpartyVersion string,
) error

func (*Keeper) OnChanOpenInit

func (k *Keeper) OnChanOpenInit(
	ctx sdk.Context,
	order channeltypes.Order,
	connectionHops []string,
	portID string,
	channelID string,
	channelCap *capabilitytypes.Capability,
	counterparty channeltypes.Counterparty,
	version string,
) (string, error)

func (*Keeper) OnRecvIBCTransferPacket

func (k *Keeper) OnRecvIBCTransferPacket(
	ctx sdk.Context,
	packet channeltypes.Packet,
	relayer sdk.AccAddress,
	transferAck ibcexported.Acknowledgement,
) error

func (*Keeper) OnTimeoutIBCTransferPacket

func (k *Keeper) OnTimeoutIBCTransferPacket(
	ctx sdk.Context,
	packet channeltypes.Packet,
	relayer sdk.AccAddress,
	transferTimeoutErr error,
) error

func (*Keeper) OnTimeoutPacket

func (k *Keeper) OnTimeoutPacket(
	ctx sdk.Context,
	packet channeltypes.Packet,
	relayer sdk.AccAddress,
) error

func (*Keeper) Params

func (*Keeper) ProcessHostChainValidatorUpdates

func (k *Keeper) ProcessHostChainValidatorUpdates(
	ctx sdk.Context,
	hc *types.HostChain,
	validator stakingtypes.Validator,
) error

ProcessHostChainValidatorUpdates processes the new validator set for a host chain

func (*Keeper) QueryDelegationHostChainAccountBalance

func (k *Keeper) QueryDelegationHostChainAccountBalance(
	ctx sdk.Context,
	hc *types.HostChain,
) error

QueryDelegationHostChainAccountBalance sends an ICQ query to get the delegation host account balance

func (*Keeper) QueryHostChainValidator

func (k *Keeper) QueryHostChainValidator(
	ctx sdk.Context,
	hc *types.HostChain,
	validatorAddress string,
) error

QueryHostChainValidator sends an ICQ query to retrieve a specific host chain validator

func (*Keeper) QueryRewardsHostChainAccountBalance

func (k *Keeper) QueryRewardsHostChainAccountBalance(
	ctx sdk.Context,
	hc *types.HostChain,
) error

QueryRewardsHostChainAccountBalance sends an ICQ query to get the rewards host account balance

func (*Keeper) QueryValidatorDelegation

func (k *Keeper) QueryValidatorDelegation(
	ctx sdk.Context,
	hc *types.HostChain,
	validator *types.Validator,
) error

QueryValidatorDelegation sends an ICQ query to get a validator delegation

func (*Keeper) RedistributeValidatorWeight

func (k *Keeper) RedistributeValidatorWeight(ctx sdk.Context, hc *types.HostChain, validator *types.Validator)

func (*Keeper) RegisterICAAccount

func (k *Keeper) RegisterICAAccount(ctx sdk.Context, connectionID, owner string) error

RegisterICAAccount registers an ICA

func (*Keeper) RevertDepositsState

func (k *Keeper) RevertDepositsState(ctx sdk.Context, deposits []*liquidstakeibctypes.Deposit)

func (*Keeper) RevertUnbondingsState

func (k *Keeper) RevertUnbondingsState(ctx sdk.Context, unbondings []*types.Unbonding)

func (*Keeper) RewardsWorkflow

func (k *Keeper) RewardsWorkflow(ctx sdk.Context, epoch int64)

func (*Keeper) SendICATransfer

func (k *Keeper) SendICATransfer(
	ctx sdk.Context,
	hc *types.HostChain,
	amount sdk.Coin,
	sender string,
	receiver string,
	portOwner string,
) (string, error)

func (*Keeper) SendProtocolFee

func (k *Keeper) SendProtocolFee(ctx sdk.Context, protocolFee sdk.Coins, moduleAccount, feeAddress string) error

SendProtocolFee to the community pool

func (*Keeper) SetDeposit

func (k *Keeper) SetDeposit(ctx sdk.Context, deposit *liquidstakeibctypes.Deposit)

func (*Keeper) SetHostChain

func (k *Keeper) SetHostChain(ctx sdk.Context, hc *types.HostChain)

SetHostChain sets a host chain in the store

func (*Keeper) SetHostChainValidator

func (k *Keeper) SetHostChainValidator(
	ctx sdk.Context,
	hc *types.HostChain,
	validator *types.Validator,
)

SetHostChainValidator sets a validator on the target host chain

func (*Keeper) SetParams

func (k *Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the total set of liquidstakeibc parameters.

func (*Keeper) SetUnbonding

func (k *Keeper) SetUnbonding(ctx sdk.Context, ub *types.Unbonding)

func (*Keeper) SetUserUnbonding

func (k *Keeper) SetUserUnbonding(ctx sdk.Context, ub *types.UserUnbonding)

func (*Keeper) SetValidatorUnbonding

func (k *Keeper) SetValidatorUnbonding(ctx sdk.Context, vu *types.ValidatorUnbonding)

func (*Keeper) SetWithdrawAddress

func (k *Keeper) SetWithdrawAddress(ctx sdk.Context, hc *types.HostChain) error

SetWithdrawAddress sends a MsgSetWithdrawAddress to set the withdrawal address to the rewards account

func (*Keeper) Unbonding

func (k *Keeper) Unbonding(
	goCtx context.Context,
	request *types.QueryUnbondingRequest,
) (*types.QueryUnbondingResponse, error)

func (*Keeper) Unbondings

func (k *Keeper) Unbondings(
	goCtx context.Context,
	request *types.QueryUnbondingsRequest,
) (*types.QueryUnbondingsResponse, error)

func (*Keeper) UndelegationWorkflow

func (k *Keeper) UndelegationWorkflow(ctx sdk.Context, epoch int64)

func (*Keeper) UpdateCValues

func (k *Keeper) UpdateCValues(ctx sdk.Context)

func (*Keeper) UpdateHostChainValidatorWeight

func (k *Keeper) UpdateHostChainValidatorWeight(
	ctx sdk.Context,
	hc *types.HostChain,
	address string,
	weight string,
) error

UpdateHostChainValidatorWeight updates a host chain validator weight

func (*Keeper) UserUnbondings

func (*Keeper) ValidatorUnbondings

func (*Keeper) ValidatorUndelegationWorkflow

func (k *Keeper) ValidatorUndelegationWorkflow(ctx sdk.Context, epoch int64)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL