keeper

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RewardsAccountBalance = "reward_account_balance"
	Delegation            = "delegation"
)

Variables

This section is empty.

Functions

func CValueRangeInvariant

func CValueRangeInvariant(k Keeper) sdk.Invariant

CValueRangeInvariant checks that if CValue is within module safety range

func DelegationCallback

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

DelegationCallback returns response of HandleDelegationCallback

func DivideAmountIntoValidatorSet

func DivideAmountIntoValidatorSet(sortedValDiff types.WeightedAddressAmounts, coin sdk.Coin) (types.ValAddressAmounts, error)

DivideAmountIntoValidatorSet : divides amount into validator set

func DivideUndelegateAmountIntoValidatorSet

func DivideUndelegateAmountIntoValidatorSet(sortedValDiff types.WeightedAddressAmounts, coin sdk.Coin) (types.ValAddressAmounts, error)

DivideUndelegateAmountIntoValidatorSet : divides undelegation amount into validator set

func FetchValidatorsToDelegate

func FetchValidatorsToDelegate(valList types.AllowListedValidators, delegationState types.DelegationState, amount sdk.Coin) (types.ValAddressAmounts, error)

FetchValidatorsToDelegate gives a list of all validators having weighted amount for few and 1uatom for rest in order to auto claim all rewards accumulated in current epoch

func FetchValidatorsToUndelegate

func FetchValidatorsToUndelegate(valList types.AllowListedValidators, delegationState types.DelegationState, amount sdk.Coin) (types.ValAddressAmounts, error)

FetchValidatorsToUndelegate gives a list of all validators having weighted amount for few and 1uatom for rest in order to auto claim all rewards accumulated in current epoch

func GetIdealCurrentDelegations

func GetIdealCurrentDelegations(valList types.AllowListedValidators, delegationState types.DelegationState, amt sdk.Coin, reverse bool) (types.WeightedAddressAmounts, error)

GetIdealCurrentDelegations returns ideal amount of delegations to validators on host chain

func HandleAllowListedValidatorSetChangeProposal

func HandleAllowListedValidatorSetChangeProposal(ctx sdk.Context, k Keeper, content types.AllowListedValidatorSetChangeProposal) error

HandleAllowListedValidatorSetChangeProposal changes the allowList validator set

func HandleMinDepositAndFeeChangeProposal

func HandleMinDepositAndFeeChangeProposal(ctx sdk.Context, k Keeper, content types.MinDepositAndFeeChangeProposal) error

HandleMinDepositAndFeeChangeProposal changes host chain params for desired min-deposit and protocol fee

func HandlePstakeFeeAddressChangeProposal added in v0.1.4

func HandlePstakeFeeAddressChangeProposal(ctx sdk.Context, k Keeper, content types.PstakeFeeAddressChangeProposal) error

HandlePstakeFeeAddressChangeProposal changes fee collector address

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers the lscosmos module invariants

func RewardsAccountBalanceCallback

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

RewardsAccountBalanceCallback returns response of HandleRewardsAccountBalanceCallback

Types

type CallbackFn

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

CallbackFn wrapper struct for interchainstaking keeper

type Callbacks

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

func (Callbacks) AddCallback

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

AddCallback adds callback using the input id and interface

func (Callbacks) Call

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

Call returns callback based on the input id, args and query

func (Callbacks) Has

func (c Callbacks) Has(id string) bool

Has checks and returns if input id is present in callbacks

func (Callbacks) RegisterCallbacks

func (c Callbacks) RegisterCallbacks() icqtypes.QueryCallbacks

RegisterCallbacks adds callbacks

type EpochsHooks

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

EpochsHooks wrapper struct for incentives keeper

func (EpochsHooks) AfterEpochEnd

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

AfterEpochEnd gets called at the end of the epoch, end of epoch is the timestamp of first block produced after epoch duration.

func (EpochsHooks) BeforeEpochStart

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

BeforeEpochStart new epoch is next block of epoch end block

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
}

Keeper of this module maintains the state of whole module

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey store.StoreKey,
	ps paramtypes.Subspace,
	bankKeeper types.BankKeeper,
	accKeeper types.AccountKeeper,
	epochKeeper types.EpochKeeper,
	ics4WrapperKeeper types.ICS4WrapperKeeper,
	channelKeeper types.ChannelKeeper,
	portKeeper types.PortKeeper,
	ibcTransferKeeper types.IBCTransferKeeper,
	icaControllerKeeper types.ICAControllerKeeper,
	icqKeeper types.ICQKeeper,
	lscosmosScopedKeeper types.ScopedKeeper,
	msgRouter *baseapp.MsgServiceRouter,
) Keeper

NewKeeper returns a new instance of ls cosmos module keeper

func (Keeper) AddBalanceToDelegationState

func (k Keeper) AddBalanceToDelegationState(ctx sdk.Context, coin sdk.Coin)

AddBalanceToDelegationState adds balance in the HostDelegationAccountBalance of types.DelegationState

func (Keeper) AddDelegatorUnbondingEpochEntry

func (k Keeper) AddDelegatorUnbondingEpochEntry(ctx sdk.Context, delegatorAddress sdk.AccAddress, epochNumber int64, amount sdk.Coin)

AddDelegatorUnbondingEpochEntry adds delegator entry for unbondign stkatom for an unbonding epoch

func (Keeper) AddEntriesForUndelegationEpoch

func (k Keeper) AddEntriesForUndelegationEpoch(ctx sdk.Context, epochNumber int64, entries []types.UndelegationEntry)

AddEntriesForUndelegationEpoch adds the input entries corresponding to the input epochNumber in types.DelegationState

func (Keeper) AddHostAccountDelegation

func (k Keeper) AddHostAccountDelegation(ctx sdk.Context, delegation types.HostAccountDelegation)

AddHostAccountDelegation append the host account delegations in types.DelegationState provided in the input

func (Keeper) AddHostAccountUndelegation

func (k Keeper) AddHostAccountUndelegation(ctx sdk.Context, undelegationEntry types.HostAccountUndelegation)

AddHostAccountUndelegation appends the input undelegationEntry in types.DelegationState

func (Keeper) AddIBCTransferToTransientStore

func (k Keeper) AddIBCTransferToTransientStore(ctx sdk.Context, amount sdk.Coin)

AddIBCTransferToTransientStore adds ibctransfer tokens that are in ibc transition CONTRACT: to be used atomically with IBCTransfer of tokens from delegation account to it's host counterpart

func (Keeper) AddICADelegateToTransientStore

func (k Keeper) AddICADelegateToTransientStore(ctx sdk.Context, amount sdk.Coin)

AddICADelegateToTransientStore adds ibctransfer tokens that are in ibc transition CONTRACT: to be used atomically with RemoveBalanceFromDelegationState

func (Keeper) AddTotalUndelegationForEpoch

func (k Keeper) AddTotalUndelegationForEpoch(ctx sdk.Context, epochNumber int64, amount sdk.Coin)

AddTotalUndelegationForEpoch adds the total undelegations corresponding to the input epoch number in types.DelegationState

func (Keeper) AddUndelegationTransferToTransientStore

func (k Keeper) AddUndelegationTransferToTransientStore(ctx sdk.Context, undelegationTransfer types.TransientUndelegationTransfer)

AddUndelegationTransferToTransientStore adds ibctransfer tokens that are in ibc transition from host chain to controller chain CONTRACT: to be used atomically with RemoveHostAccountUndelegation (after successful undelegations)

func (Keeper) AfterEpochEnd

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

AfterEpochEnd handle the "stake", "reward" and "undelegate" epoch and their respective actions 1. "stake" generates delegate transaction for delegating the amount of stake accumulated over the "stake" epoch 2. "reward" generates delegate transaction for withdrawing and restaking the amount of stake accumulated over the "reward" epochs and shift the amount to next epoch if the min amount is not reached 3. "undelegate" generated the undelegate transaction for undelegating the amount accumulated over the "undelegate" epoch

func (Keeper) AllowListedValidators

AllowListedValidators queries the current allow listed validators set

func (Keeper) AuthenticateCapability

func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool

AuthenticateCapability wraps the lscosmosScopedKeeper's AuthenticateCapability function

func (Keeper) BeforeEpochStart

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

BeforeEpochStart - call hook if registered

func (Keeper) BeginBlock

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

BeginBlock will use utils.ApplyFuncIfNoError to apply the changes made by the functions passed as parameters

func (Keeper) BindPort

func (k Keeper) BindPort(ctx sdk.Context, portID string) error

BindPort defines a wrapper function for the ort Keeper's function in order to expose it to module's InitGenesis function

func (Keeper) CValue

CValue computes and returns the c value

func (Keeper) CallbackHandler

func (k Keeper) CallbackHandler() Callbacks

CallbackHandler returns Callbacks with empty entries

func (Keeper) ChanCloseInit

func (k Keeper) ChanCloseInit(ctx sdk.Context, portID, channelID string) error

ChanCloseInit defines a wrapper function for the channel Keeper's function

func (Keeper) CheckPendingICATxs

func (k Keeper) CheckPendingICATxs(ctx sdk.Context) (bool, error)

CheckPendingICATxs checks if there are any ongoing ica transaction which are stuck

func (Keeper) ClaimCapability

func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error

ClaimCapability allows the module that can claim a capability that IBC module passes to it

func (Keeper) ConvertStkToToken

func (k Keeper) ConvertStkToToken(ctx sdk.Context, stkCoin sdk.DecCoin, cValue sdk.Dec) (sdk.Coin, sdk.DecCoin)

ConvertStkToToken converts a stk coin to token with the c value provided in the input.

func (Keeper) ConvertTokenToStk

func (k Keeper) ConvertTokenToStk(ctx sdk.Context, token sdk.DecCoin, cValue sdk.Dec) (sdk.Coin, sdk.DecCoin)

ConvertTokenToStk converts a token coin to stk coin with the c value provided in the input.

func (Keeper) DelegateMsgs

func (k Keeper) DelegateMsgs(ctx sdk.Context, amount math.Int, denom string, delegationState types.DelegationState) ([]proto.Message, error)

DelegateMsgs gives the list of Delegate Txs to be executed based on the current state and params. CONTRACT: allowlistedValList.len > 0, amount > 0

func (Keeper) DelegationEpochWorkFlow

func (k Keeper) DelegationEpochWorkFlow(ctx sdk.Context, hostChainParams lscosmostypes.HostChainParams) error

DelegationEpochWorkFlow handles the delegation epoch work flow : 1. Checks and adds balance present in the rewards module account to delegation module account 2. Checks and adds balance present in the deposit module account to delegation module account 3. Checks and IBC transfers the balance present in the delegation module account to other chain 4. Transfer fees to the fee address in the host chain params

func (Keeper) DelegationState

DelegationState queries the current delegation state

func (Keeper) DelegatorUnbondingEpochEntries

DelegatorUnbondingEpochEntries queries all the delegator unbonding epoch entries corresponding to the input delegator address in types.QueryAllDelegatorUnbondingEpochEntriesRequest

func (Keeper) DelegatorUnbondingEpochEntry

DelegatorUnbondingEpochEntry queries the delegator unbonding epoch entry details corresponding to the input epoch number and delegator address in types.QueryDelegatorUnbondingEpochEntryRequest

func (Keeper) DepositModuleAccount

DepositModuleAccount queries the deposit module account balance

func (Keeper) DoDelegate

func (k Keeper) DoDelegate(ctx sdk.Context) error

DoDelegate generates and executes ICA transactions based on the generated delegation state from DelegateMsgs

func (Keeper) FailUnbondingEpochCValue

func (k Keeper) FailUnbondingEpochCValue(ctx sdk.Context, epochNumber int64, undelegationAmount sdk.Coin)

FailUnbondingEpochCValue sets unbonding epochCValue as timeout for undelegation

func (Keeper) FailedUnbondings

FailedUnbondings queries the failed unbonding entries corresponding to the input delegator address in types.QueryUnclaimedRequest

func (Keeper) ForceUpdateHostAccountDelegation

func (k Keeper) ForceUpdateHostAccountDelegation(ctx sdk.Context, delegation types.HostAccountDelegation)

ForceUpdateHostAccountDelegation updates the delegation-state for a validator.

func (Keeper) GenerateAndExecuteICATx

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

GenerateAndExecuteICATx does ica transactions with messages, optimistic bool does not check for channel to be open. only use to do icatxns when channel is getting created.

func (Keeper) GetAllValidatorsState

func (k Keeper) GetAllValidatorsState(ctx sdk.Context, denom string) (types.AllowListedVals, types.HostAccountDelegations)

GetAllValidatorsState returns the combined allowed listed validators set and combined delegation state. It is done to keep the old validators in the loop while calculating weighted amounts for delegation and undelegation

func (Keeper) GetAllowListedValidators

func (k Keeper) GetAllowListedValidators(ctx sdk.Context) types.AllowListedValidators

GetAllowListedValidators gets the allow listed validator set

func (Keeper) GetCValue

func (k Keeper) GetCValue(ctx sdk.Context) sdk.Dec

GetCValue gets the C value after recalculating everytime when the function is called. Returns 1 if stakedAmount or mintedAmount is zero.

func (Keeper) GetDelegationModuleAccount

func (k Keeper) GetDelegationModuleAccount(ctx sdk.Context) authtypes.ModuleAccountI

GetDelegationModuleAccount returns the delegation module account interface

func (Keeper) GetDelegationState

func (k Keeper) GetDelegationState(ctx sdk.Context) types.DelegationState

GetDelegationState gets the delegation state in store

func (Keeper) GetDelegationTransientAmount

func (k Keeper) GetDelegationTransientAmount(ctx sdk.Context) math.Int

GetDelegationTransientAmount returns the delegation transient amount of the IBC denom

func (Keeper) GetDelegatorUnbondingEpochEntry

func (k Keeper) GetDelegatorUnbondingEpochEntry(ctx sdk.Context, delegatorAddress sdk.AccAddress, epochNumber int64) types.DelegatorUnbondingEpochEntry

GetDelegatorUnbondingEpochEntry gets delegator entry for unbondign stkatom for an unbonding epoch

func (Keeper) GetDepositAccountAmount

func (k Keeper) GetDepositAccountAmount(ctx sdk.Context) math.Int

GetDepositAccountAmount returns the deposit account amount of the IBC denom

func (Keeper) GetDepositModuleAccount

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

GetDepositModuleAccount returns deposit module account interface

func (Keeper) GetHostAccountDelegation

func (k Keeper) GetHostAccountDelegation(ctx sdk.Context, validatorAddress string) types.HostAccountDelegation

GetHostAccountDelegation gets the delegation for a particular validator

func (Keeper) GetHostAccountMaturedUndelegations

func (k Keeper) GetHostAccountMaturedUndelegations(ctx sdk.Context) []types.HostAccountUndelegation

GetHostAccountMaturedUndelegations returns the host account matured undelegations

func (Keeper) GetHostAccountUndelegationForEpoch

func (k Keeper) GetHostAccountUndelegationForEpoch(ctx sdk.Context, epochNumber int64) (types.HostAccountUndelegation, error)

GetHostAccountUndelegationForEpoch returns the host account undelegation the input epoch number

func (Keeper) GetHostAccounts

func (k Keeper) GetHostAccounts(ctx sdk.Context) types.HostAccounts

GetHostAccounts gets host account port ids from store

func (Keeper) GetHostChainParams

func (k Keeper) GetHostChainParams(ctx sdk.Context) types.HostChainParams

GetHostChainParams gets the host chain params in store

func (Keeper) GetHostChainRewardAddress

func (k Keeper) GetHostChainRewardAddress(ctx sdk.Context) types.HostChainRewardAddress

GetHostChainRewardAddress gets host chain reward address

func (Keeper) GetHostDelegationAccountAmount

func (k Keeper) GetHostDelegationAccountAmount(ctx sdk.Context) math.Int

GetHostDelegationAccountAmount returns the host account delegation account amount of IBC denom

func (Keeper) GetIBCDenom

func (k Keeper) GetIBCDenom(ctx sdk.Context) string

GetIBCDenom returns IBC denom in form of string

func (Keeper) GetIBCTransferTransientAmount

func (k Keeper) GetIBCTransferTransientAmount(ctx sdk.Context) math.Int

GetIBCTransferTransientAmount returns the IBC transfer transient amount of the IBC denom

func (Keeper) GetIBCTransientStore

func (k Keeper) GetIBCTransientStore(ctx sdk.Context) types.IBCAmountTransientStore

GetIBCTransientStore gets tokens that are in ibc transition

func (Keeper) GetMintedAmount

func (k Keeper) GetMintedAmount(ctx sdk.Context) math.Int

GetMintedAmount gets minted amount

func (Keeper) GetModuleState

func (k Keeper) GetModuleState(ctx sdk.Context) bool

GetModuleState blocks all module transactions except for register proposal or valset update

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetRewardBoosterModuleAccount

func (k Keeper) GetRewardBoosterModuleAccount(ctx sdk.Context) authtypes.ModuleAccountI

GetRewardBoosterModuleAccount returns the rewards booster module account interface

func (Keeper) GetRewardModuleAccount

func (k Keeper) GetRewardModuleAccount(ctx sdk.Context) authtypes.ModuleAccountI

GetRewardModuleAccount returns the reward module account interface

func (Keeper) GetStakedAmount

func (k Keeper) GetStakedAmount(ctx sdk.Context) math.Int

GetStakedAmount returns the total staked amount stored in delegation state

func (Keeper) GetUnbondingEpochCValue

func (k Keeper) GetUnbondingEpochCValue(ctx sdk.Context, epochNumber int64) types.UnbondingEpochCValue

GetUnbondingEpochCValue sets cvalue for unbonding epoch

func (Keeper) GetUndelegationModuleAccount

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

GetUndelegationModuleAccount returns the undelegation module account interface

func (Keeper) HandleDelegationCallback

func (k Keeper) HandleDelegationCallback(ctx sdk.Context, response []byte, _ icqtypes.Query) error

HandleDelegationCallback generates and executes delegation query

func (Keeper) HandleRewardsAccountBalanceCallback

func (k Keeper) HandleRewardsAccountBalanceCallback(ctx sdk.Context, response []byte, _ icqtypes.Query) error

HandleRewardsAccountBalanceCallback generates and executes rewards account balance query

func (Keeper) HostAccountUndelegation

HostAccountUndelegation queries the host account undelegation details corresponding to the input epoch number in types.QueryHostAccountUndelegationRequest

func (Keeper) HostAccounts

HostAccounts queries the host accounts

func (Keeper) HostChainParams

HostChainParams queries the host chain params

func (Keeper) IBCTransientStore

IBCTransientStore queries the current IBC transient store

func (Keeper) IsBound

func (k Keeper) IsBound(ctx sdk.Context, portID string) bool

IsBound checks if the module is already bound to the desired port

func (Keeper) IterateAllDelegatorUnbondingEpochEntry

func (k Keeper) IterateAllDelegatorUnbondingEpochEntry(ctx sdk.Context) []types.DelegatorUnbondingEpochEntry

IterateAllDelegatorUnbondingEpochEntry returns a list of all epoch entries ever created in the KV store by using the prefix iterator

func (Keeper) IterateAllUnbondingEpochCValues

func (k Keeper) IterateAllUnbondingEpochCValues(ctx sdk.Context) []types.UnbondingEpochCValue

IterateAllUnbondingEpochCValues sets cvalue for all epochs

func (Keeper) IterateDelegatorUnbondingEpochEntry

func (k Keeper) IterateDelegatorUnbondingEpochEntry(ctx sdk.Context, delegatorAddress sdk.AccAddress) []types.DelegatorUnbondingEpochEntry

IterateDelegatorUnbondingEpochEntry returns a list of types.DelegatorUnbondingEpochEntry by using prefix for iterating through the KV store entries using the input delegator address

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MatureUnbondingEpochCValue

func (k Keeper) MatureUnbondingEpochCValue(ctx sdk.Context, epochNumber int64)

MatureUnbondingEpochCValue sets unbonding epochCValue as matured

func (Keeper) MintTokens

func (k Keeper) MintTokens(ctx sdk.Context, mintCoin sdk.Coin, delegatorAddress sdk.AccAddress) error

MintTokens in the given account

func (Keeper) ModuleState

ModuleState queries the current module state

func (Keeper) NewCapability

func (k Keeper) NewCapability(ctx sdk.Context, name string) error

NewCapability allows the module that can initiate and claim a capability that IBC module passes to it

func (Keeper) NewEpochHooks

func (k Keeper) NewEpochHooks() EpochsHooks

NewEpochHooks Return the wrapper struct

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

OnAcknowledgementIBCTransferPacket performs the following steps : 1. Returns early if there is an error 2. Performs health checks the packet received 3. Updates balance in the delegation state by using AddBalanceToDelegationState 4. Removes amount from IBCTransferFromTransientStore

func (Keeper) OnAcknowledgementPacket

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

OnAcknowledgementPacket implements the IBCModule interface

func (Keeper) OnChanCloseConfirm

func (k Keeper) OnChanCloseConfirm(
	ctx sdk.Context,
	portID,
	channelID string,
) error

OnChanCloseConfirm implements the IBCModule interface

func (Keeper) OnChanCloseInit

func (k Keeper) OnChanCloseInit(
	ctx sdk.Context,
	portID,
	channelID string,
) error

OnChanCloseInit implements the IBCModule interface

func (Keeper) OnChanOpenAck

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

OnChanOpenAck implements the IBCModule interface

func (Keeper) OnChanOpenConfirm

func (k Keeper) OnChanOpenConfirm(
	ctx sdk.Context,
	portID,
	channelID string,
) error

OnChanOpenConfirm implements the IBCModule interface

func (Keeper) OnChanOpenInit

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

OnChanOpenInit implements the IBCModule interface

func (Keeper) OnChanOpenTry

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

OnChanOpenTry implements the IBCModule interface

func (Keeper) OnRecvIBCTransferPacket

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

OnRecvIBCTransferPacket performs the following steps : 1. Checks if the acknowledgment was a success or not 2. Clears transient entries based on packet contents 3. Update the matured unbonding epoch c value using MatureUnbondingEpochCValue

func (Keeper) OnRecvPacket

func (k Keeper) OnRecvPacket(
	ctx sdk.Context,
	modulePacket channeltypes.Packet,
	relayer sdk.AccAddress,
) ibcexported.Acknowledgement

OnRecvPacket implements the IBCModule interface

func (Keeper) OnTimeoutIBCTransferPacket

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

OnTimeoutIBCTransferPacket performs the following actions : 1. Returns early if there is a packet timeout error 2. Perform health checks on the packet received 3. Remove the amount from IBCTransferFromTransientStore

func (Keeper) OnTimeoutPacket

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

OnTimeoutPacket implements the IBCModule interface

func (Keeper) Params

Params queries the module params

func (Keeper) PendingUnbondings

PendingUnbondings queries the pending unbonding entries corresponding to the input delegator address in types.QueryUnclaimedRequest

func (Keeper) ProcessMaturedUndelegation

func (k Keeper) ProcessMaturedUndelegation(ctx sdk.Context) error

ProcessMaturedUndelegation processes all the matured undelegations by fetching all the host account matured undelegations and processing them one by one

func (Keeper) RemoveBalanceFromDelegationState

func (k Keeper) RemoveBalanceFromDelegationState(ctx sdk.Context, coins sdk.Coins)

RemoveBalanceFromDelegationState subtracts balance in the HostDelegationAccountBalance of types.DelegationState

func (Keeper) RemoveDelegatorUnbondingEpochEntry

func (k Keeper) RemoveDelegatorUnbondingEpochEntry(ctx sdk.Context, delegatorAddress sdk.AccAddress, epochNumber int64)

RemoveDelegatorUnbondingEpochEntry removes the delegator unbonding epoch entry for the input delegator address and epoch number

func (Keeper) RemoveHostAccountUndelegation

func (k Keeper) RemoveHostAccountUndelegation(ctx sdk.Context, epochNumber int64) error

RemoveHostAccountUndelegation removes the completion time for undelegation epoch corresponding to the input epoch number in types.DelegationState

func (Keeper) RemoveIBCTransferFromTransientStore

func (k Keeper) RemoveIBCTransferFromTransientStore(ctx sdk.Context, amount sdk.Coin)

RemoveIBCTransferFromTransientStore removes ibctransfer tokens that are in ibc transition CONTRACT: to be used atomically with AddBalanceToDelegationState

func (Keeper) RemoveICADelegateFromTransientStore

func (k Keeper) RemoveICADelegateFromTransientStore(ctx sdk.Context, amount sdk.Coin)

RemoveICADelegateFromTransientStore removes ibctransfer tokens that are in ibc transition Contract: to be used atomically with AddHostAccountDelegation and AddBalanceToDelegationState(incase of failed txns)

func (Keeper) RemoveUndelegationTransferFromTransientStore

func (k Keeper) RemoveUndelegationTransferFromTransientStore(ctx sdk.Context, amount sdk.Coin) (types.TransientUndelegationTransfer, error)

RemoveUndelegationTransferFromTransientStore removes ibctransfer tokens that are in ibc transition from host chain to controller chain Contract: to be used atomically with MatureUnbondingEpochCValue (after successful undelegations) and AddHostAccountUndelegation ( after failed ICA+IBC txn - matured undelegations)

func (Keeper) RewardEpochEpochWorkFlow

func (k Keeper) RewardEpochEpochWorkFlow(ctx sdk.Context, hostChainParams lscosmostypes.HostChainParams) error

RewardEpochEpochWorkFlow handles the rewards epoch work flow generates and executes the ICA transaction for claiming rewards

func (Keeper) SendProtocolFee

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

SendProtocolFee to the community pool

func (Keeper) SendTokensToDepositModule

func (k Keeper) SendTokensToDepositModule(ctx sdk.Context, depositCoin sdk.Coins, senderAddress sdk.AccAddress) error

SendTokensToDepositModule sends the tokens to DepositModuleAccount

func (Keeper) SetAllowListedValidators

func (k Keeper) SetAllowListedValidators(ctx sdk.Context, allowlistedValidators types.AllowListedValidators)

SetAllowListedValidators sets allowlisted validator set

func (Keeper) SetDelegationState

func (k Keeper) SetDelegationState(ctx sdk.Context, delegationState types.DelegationState)

SetDelegationState sets the delegation state in store

func (Keeper) SetDelegatorUnbondingEpochEntry

func (k Keeper) SetDelegatorUnbondingEpochEntry(ctx sdk.Context, unbondingEpochEntry types.DelegatorUnbondingEpochEntry)

SetDelegatorUnbondingEpochEntry sets delegator entry for unbondign stkatom for an unbonding epoch

func (Keeper) SetHostAccounts

func (k Keeper) SetHostAccounts(ctx sdk.Context, hostAccounts types.HostAccounts)

SetHostAccounts sets host account port ids in store

func (Keeper) SetHostChainDelegationAddress

func (k Keeper) SetHostChainDelegationAddress(ctx sdk.Context, addr string) error

SetHostChainDelegationAddress sets the host chain delegator address in types.DelegationState

func (Keeper) SetHostChainParams

func (k Keeper) SetHostChainParams(ctx sdk.Context, hostChainParams types.HostChainParams)

SetHostChainParams sets the host chain params in store

func (Keeper) SetHostChainRewardAddress

func (k Keeper) SetHostChainRewardAddress(ctx sdk.Context, hostChainRewardAddress types.HostChainRewardAddress)

SetHostChainRewardAddress sets host chain reward address

func (Keeper) SetHostChainRewardAddressIfEmpty

func (k Keeper) SetHostChainRewardAddressIfEmpty(ctx sdk.Context, hostChainRewardAddress types.HostChainRewardAddress) error

SetHostChainRewardAddressIfEmpty sets host chain reward address

func (Keeper) SetIBCTransientStore

func (k Keeper) SetIBCTransientStore(ctx sdk.Context, ibcAmountTransientStore types.IBCAmountTransientStore)

SetIBCTransientStore sets tokens that are in ibc transition

func (Keeper) SetModuleState

func (k Keeper) SetModuleState(ctx sdk.Context, enable bool)

SetModuleState allows all module transactions

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetUnbondingEpochCValue

func (k Keeper) SetUnbondingEpochCValue(ctx sdk.Context, unbondingEpochCValue types.UnbondingEpochCValue)

SetUnbondingEpochCValue sets cvalue for unbonding epoch

func (Keeper) SubtractHostAccountDelegation

func (k Keeper) SubtractHostAccountDelegation(ctx sdk.Context, delegation types.HostAccountDelegation) error

SubtractHostAccountDelegation calls the removeHostAccountDelegation function to subtract host account delegations in types.DelegationState

func (Keeper) UnbondingEpochCValue

UnbondingEpochCValue queries the unbonding epoch c value details corresponding to the input epoch number in types.QueryUnbondingEpochCValueRequest

func (Keeper) Unclaimed

Unclaimed queries the unclaimed entries corresponding to the input delegator address in types.QueryUnclaimedRequest

func (Keeper) UndelegateMsgs

func (k Keeper) UndelegateMsgs(ctx sdk.Context, amount math.Int, denom string, delegationState types.DelegationState) ([]proto.Message, []types.UndelegationEntry, error)

UndelegateMsgs gives the list of Undelegate Txs to be executed based on the current state and params. CONTRACT: allowlistedValList.len > 0, amount > 0

func (Keeper) UndelegationEpochWorkFlow

func (k Keeper) UndelegationEpochWorkFlow(ctx sdk.Context, hostChainParams lscosmostypes.HostChainParams, epochNumber int64) error

UndelegationEpochWorkFlow handles the undelegation epoch work flow : 1. Fetches host account undelegations using in GetHostAccountUndelegationForEpoch 2. Convert stk coin to token using ConvertStkToToken based on the current c value 3. Form undelegation messages using the current delegation state 4. Generate and execute the ICA transaction for the undelegation messages 5. Perform KV store changes based on the previous actions Returns nil or an error based on the checks in the function

func (Keeper) UpdateCompletionTimeForUndelegationEpoch

func (k Keeper) UpdateCompletionTimeForUndelegationEpoch(ctx sdk.Context, epochNumber int64, completionTime time.Time)

UpdateCompletionTimeForUndelegationEpoch updates the completion time for undelegation epoch corresponding to the input epoch number in types.DelegationState

Jump to

Keyboard shortcuts

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