keeper

package
v0.0.0-...-1c33bd2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetResultFromAcknowledgement

func GetResultFromAcknowledgement(acknowledgement []byte) ([]byte, error)

func NewMsgServerImpl

func NewMsgServerImpl(keeper *Keeper) types.MsgServer

NewMsgServerImpl creates and returns a new types.MsgServer, fulfilling the interstaking Msg service interface

Types

type Hooks

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

func (Hooks) AfterEpochEnd

func (Hooks) AfterEpochEnd(_ sdk.Context, _ string, _ int64)

AfterEpochEnd implements types.EpochHooks

func (Hooks) BeforeEpochStart

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

BeforeEpochStart implements types.EpochHooks

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	storeKey storetypes.StoreKey,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	epochKeeper types.EpochKeeper,
	ibcClientKeeper *ibckeeper.Keeper,
	icaCtlKeeper icacontrollerkeeper.Keeper,
	ibcTransferKeeper ibctransferkeeper.Keeper,
) Keeper

func (Keeper) AddSouceChain

func (k Keeper) AddSouceChain(ctx sdk.Context, sourceChain *types.SourceChain) error

func (Keeper) AfterWithdrawDelegateReward

func (k Keeper) AfterWithdrawDelegateReward(ctx sdk.Context, sourceChain *types.SourceChain, reward math.Int) error

func (Keeper) ClaimUnbonding

func (k Keeper) ClaimUnbonding(ctx sdk.Context, deletator sdk.AccAddress, epoch uint64, chainID string) (math.Int, error)

ClaimUnbonding implement delegator claim reward and stake token.

func (Keeper) CreateProxyDelegationForEpoch

func (k Keeper) CreateProxyDelegationForEpoch(ctx sdk.Context, epochNumber uint64)

CreateProxyDelegationForEpoch create a new ProxyDelegation in current epoch for all available chain. If current epoch already has ProxyDelegation for the chain, then do nothing

func (Keeper) CreateProxyUnbondingForEpoch

func (k Keeper) CreateProxyUnbondingForEpoch(ctx sdk.Context, epochNumber uint64) *types.EpochProxyUnbonding

CreateProxyUnbondingForEpoch a new unbonding in current epoch.

func (*Keeper) Delegate

func (k *Keeper) Delegate(ctx sdk.Context, chainID string, amount math.Int, caller sdk.AccAddress) (*types.ProxyDelegation, error)

Delegate performs a liquid stake delegation. delegator transfer the ibcToken to module account then get derivative token by the rate.

func (Keeper) GetAllProxyDelegation

func (k Keeper) GetAllProxyDelegation(ctx sdk.Context) []types.ProxyDelegation

func (Keeper) GetCallBack

func (k Keeper) GetCallBack(ctx sdk.Context, channel string, port string, sequence uint64) (*types.IBCCallback, bool)

func (Keeper) GetChianProxyDelegationID

func (k Keeper) GetChianProxyDelegationID(ctx sdk.Context, chainID string, epochNumber uint64) (uint64, bool)

GetChianProxyDelegationID get ProxyDelegation's ID of a chain by epoch and chainID

func (Keeper) GetDelegaionProcessingAmount

func (k Keeper) GetDelegaionProcessingAmount(delegations []types.ProxyDelegation) map[string]math.Int

func (Keeper) GetEpochProxyUnboundings

func (k Keeper) GetEpochProxyUnboundings(ctx sdk.Context, epoch uint64) (*types.EpochProxyUnbonding, bool)

func (Keeper) GetProxyDelegation

func (k Keeper) GetProxyDelegation(ctx sdk.Context, id uint64) (*types.ProxyDelegation, bool)

GetProxyDelegation return ProxyDelegation by id

func (Keeper) GetProxyDelegationID

func (k Keeper) GetProxyDelegationID(ctx sdk.Context) uint64

func (Keeper) GetSourceChain

func (k Keeper) GetSourceChain(ctx sdk.Context, chainID string) (*types.SourceChain, bool)

GetSourceChain get source chain by chainID

func (Keeper) GetSourceChainAddr

func (k Keeper) GetSourceChainAddr(ctx sdk.Context, connectionID string, ctlAddress string) (string, error)

func (Keeper) GetUserUnbonding

func (k Keeper) GetUserUnbonding(ctx sdk.Context, chainID string, epoch uint64, delegator string) (*types.UserUnbonding, bool)

func (Keeper) GetUserUnbondingID

func (k Keeper) GetUserUnbondingID(ctx sdk.Context, id string) (*types.UserUnbonding, bool)

func (Keeper) HandleIBCAcknowledgement

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

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

func (Keeper) IncreaseProxyDelegationID

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

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) ProcessEpochProxyUnbondings

func (k Keeper) ProcessEpochProxyUnbondings(ctx sdk.Context, epoch uint64, proxyUnbondings []types.ProxyUnbonding) error

func (*Keeper) ProcessProxyDelegation

func (k *Keeper) ProcessProxyDelegation(ctx sdk.Context, curEpochNumber uint64, records []types.ProxyDelegation)

ProcessProxyDelegation start liquid stake on source chain with provide delegation records. This process will continue to advance the status of the ProxyDelegation according to the IBC ack. So here just start and restart the process.

func (Keeper) ProcessUndelegationEpoch

func (k Keeper) ProcessUndelegationEpoch(ctx sdk.Context, epochNumber uint64)

ProcessUndelegationEpoch advance the Unbondings in the past epoch into the next status

func (Keeper) RemoveCallBack

func (k Keeper) RemoveCallBack(ctx sdk.Context, channel string, port string, sequence uint64)

func (Keeper) SetCallBack

func (k Keeper) SetCallBack(ctx sdk.Context, channel string, port string, sequence uint64, callback *types.IBCCallback)

func (Keeper) SetChainProxyDelegationID

func (k Keeper) SetChainProxyDelegationID(ctx sdk.Context, chainID string, epochNumber uint64, delegationID uint64)

SetChianProxyDelegationID set ProxyDelegation's ID of chain at specific epoch and chainID

func (Keeper) SetDistriWithdrawAddress

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

SetDistriWithdrawAddress set the sourcechain staking reward recipient. Only after successful, the sourcechain is available.

func (Keeper) SetEpochProxyUnboundings

func (k Keeper) SetEpochProxyUnboundings(ctx sdk.Context, unbondings *types.EpochProxyUnbonding)

func (Keeper) SetProxyDelegation

func (k Keeper) SetProxyDelegation(ctx sdk.Context, id uint64, delegation *types.ProxyDelegation)

SetProxyDelegation store ProxyDelegation

func (Keeper) SetSourceChain

func (k Keeper) SetSourceChain(ctx sdk.Context, sourceChain *types.SourceChain)

func (Keeper) SetUserUnbonding

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

func (Keeper) StartReinvest

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

func (Keeper) Undelegate

func (k Keeper) Undelegate(ctx sdk.Context, chainID string, amount math.Int, delegator sdk.AccAddress) (*types.UserUnbonding, error)

func (Keeper) UpdateRedeemRate

func (k Keeper) UpdateRedeemRate(ctx sdk.Context, delegations []types.ProxyDelegation)

UpdateRedeemRate update redeemrate for each source chain TODO Record the rate in the last few epochs, and then average?

func (Keeper) WithdrawDelegateReward

func (k Keeper) WithdrawDelegateReward(ctx sdk.Context, sourceChain *types.SourceChain) error

type Querier

type Querier struct {
	Keeper
}

func (Querier) EpochProxyUnbonding

EpochProxyUnbonding implements types.QueryServer

func (Querier) ProxyDelegation

ProxyDelegation implements types.QueryServer

func (Querier) SourceChain

SourceChain implements types.QueryServer

func (Querier) UserUnbonding

UserUnbonding implements types.QueryServer

Jump to

Keyboard shortcuts

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