Documentation ¶
Index ¶
- Constants
- func AllInvariants(k Keeper) sdk.Invariant
- func ClaimCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ...) error
- func DelegateCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ...) error
- func DelegatorSharesCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- func FeeBalanceCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- func GetValidatorFromAddress(validators []*types.Validator, address string) (val types.Validator, index int64, found bool)
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func RebalanceCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ...) error
- func RedemptionCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ...) error
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func ReinvestCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ...) error
- func UndelegateCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ...) error
- func ValidatorExchangeRateCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- func WithdrawalBalanceCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- type Hooks
- type ICACallback
- type ICACallbacks
- func (c ICACallbacks) AddICACallback(id string, fn interface{}) icacallbackstypes.ICACallbackHandler
- func (c ICACallbacks) CallICACallback(ctx sdk.Context, id string, packet channeltypes.Packet, ...) error
- func (c ICACallbacks) HasICACallback(id string) bool
- func (c ICACallbacks) RegisterICACallbacks() icacallbackstypes.ICACallbackHandler
- type ICQCallback
- type ICQCallbacks
- func (c ICQCallbacks) AddICQCallback(id string, fn interface{}) icqtypes.QueryCallbacks
- func (c ICQCallbacks) CallICQCallback(ctx sdk.Context, id string, args []byte, query icqtypes.Query) error
- func (c ICQCallbacks) HasICQCallback(id string) bool
- func (c ICQCallbacks) RegisterICQCallbacks() icqtypes.QueryCallbacks
- type IcaTx
- type Keeper
- func (k Keeper) AddDelegationToValidator(ctx sdk.Context, hostZone types.HostZone, validatorAddress string, ...) (success bool)
- func (k Keeper) AddValidatorToHostZone(ctx sdk.Context, chainId string, validator types.Validator, ...) error
- func (k Keeper) AddValidatorsProposal(ctx sdk.Context, msg *types.AddValidatorsProposal) error
- func (k Keeper) AddressUnbondings(c context.Context, req *types.QueryAddressUnbondings) (*types.QueryAddressUnbondingsResponse, error)
- func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochInfo epochstypes.EpochInfo)
- func (k Keeper) AllocateHostZoneReward(ctx sdk.Context)
- func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochInfo epochstypes.EpochInfo)
- func (k Keeper) BurnTokens(ctx sdk.Context, hostZone types.HostZone, stTokenBurnAmount sdkmath.Int) error
- func (k Keeper) CheckIsStToken(ctx sdk.Context, denom string) bool
- func (k Keeper) CleanupEpochUnbondingRecords(ctx sdk.Context, epochNumber uint64) bool
- func (k Keeper) ConfirmValSetHasSpace(ctx sdk.Context, validators []*types.Validator) error
- func (k Keeper) CreateDepositRecordsForEpoch(ctx sdk.Context, epochNumber uint64)
- func (k Keeper) CreateEpochUnbondingRecord(ctx sdk.Context, epochNumber uint64) bool
- func (k Keeper) DecrementHostZoneUnbonding(ctx sdk.Context, userRedemptionRecord recordstypes.UserRedemptionRecord, ...) error
- func (k Keeper) DelegateOnHost(ctx sdk.Context, hostZone types.HostZone, amt sdk.Coin, ...) error
- func (k Keeper) EpochTracker(c context.Context, req *types.QueryGetEpochTrackerRequest) (*types.QueryGetEpochTrackerResponse, error)
- func (k Keeper) EpochTrackerAll(c context.Context, req *types.QueryAllEpochTrackerRequest) (*types.QueryAllEpochTrackerResponse, error)
- func (k Keeper) GetAllActiveHostZone(ctx sdk.Context) (list []types.HostZone)
- func (k Keeper) GetAllEpochTracker(ctx sdk.Context) (list []types.EpochTracker)
- func (k Keeper) GetAllHostZone(ctx sdk.Context) (list []types.HostZone)
- func (k Keeper) GetChainID(ctx sdk.Context, connectionID string) (string, error)
- func (k Keeper) GetClaimableRedemptionRecord(ctx sdk.Context, msg *types.MsgClaimUndelegatedTokens) (*recordstypes.UserRedemptionRecord, error)
- func (k Keeper) GetConnectionId(ctx sdk.Context, portId string) (string, error)
- func (k Keeper) GetCounterpartyChainId(ctx sdk.Context, connectionID string) (string, error)
- func (k Keeper) GetEpochTracker(ctx sdk.Context, epochIdentifier string) (val types.EpochTracker, found bool)
- func (k Keeper) GetHostZone(ctx sdk.Context, chain_id string) (val types.HostZone, found bool)
- func (k Keeper) GetHostZoneFromHostDenom(ctx sdk.Context, denom string) (*types.HostZone, error)
- func (k Keeper) GetHostZoneFromIBCDenom(ctx sdk.Context, denom string) (*types.HostZone, error)
- func (k Keeper) GetHostZoneFromTransferChannelID(ctx sdk.Context, channelID string) (hostZone types.HostZone, found bool)
- func (k Keeper) GetHostZoneUnbondingMsgs(ctx sdk.Context, hostZone types.HostZone) (msgs []proto.Message, totalAmountToUnbond sdkmath.Int, ...)
- func (k Keeper) GetICATimeoutNanos(ctx sdk.Context, epochType string) (uint64, error)
- func (k Keeper) GetLatestCompletionTime(ctx sdk.Context, msgResponses [][]byte) (*time.Time, error)
- func (k Keeper) GetLightClientHeightSafely(ctx sdk.Context, connectionID string) (uint64, error)
- func (k Keeper) GetLightClientTimeSafely(ctx sdk.Context, connectionID string) (uint64, error)
- func (k Keeper) GetModuleAccountBalance(hostZone types.HostZone, depositRecords []recordstypes.DepositRecord) sdkmath.Int
- func (k *Keeper) GetParam(ctx sdk.Context, key []byte) uint64
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetRedemptionAccount(ctx sdk.Context, hostZone types.HostZone) (*types.ICAAccount, bool)
- func (k Keeper) GetRedemptionTransferMsg(ctx sdk.Context, userRedemptionRecord *recordstypes.UserRedemptionRecord, ...) (*IcaTx, error)
- func (k Keeper) GetStartTimeNextEpoch(ctx sdk.Context, epochType string) (uint64, error)
- func (k Keeper) GetStrideEpochElapsedShare(ctx sdk.Context) (sdk.Dec, error)
- func (k Keeper) GetTargetValAmtsForHostZone(ctx sdk.Context, hostZone types.HostZone, finalDelegation sdkmath.Int) (map[string]sdkmath.Int, error)
- func (k Keeper) GetTotalValidatorDelegations(hostZone types.HostZone) sdkmath.Int
- func (k Keeper) GetTotalValidatorWeight(hostZone types.HostZone) uint64
- func (k Keeper) GetUndelegatedBalance(hostZone types.HostZone, depositRecords []recordstypes.DepositRecord) sdkmath.Int
- func (k Keeper) GetValidatorDelegationAmtDifferences(ctx sdk.Context, hostZone types.HostZone) (map[string]sdkmath.Int, error)
- func (k Keeper) Hooks() Hooks
- func (k Keeper) HostZone(c context.Context, req *types.QueryGetHostZoneRequest) (*types.QueryGetHostZoneResponse, error)
- func (k Keeper) HostZoneAll(c context.Context, req *types.QueryAllHostZoneRequest) (*types.QueryAllHostZoneResponse, error)
- func (k Keeper) ICACallbackHandler() ICACallbacks
- func (k Keeper) ICQCallbackHandler() ICQCallbacks
- func (k Keeper) InitiateAllHostZoneUnbondings(ctx sdk.Context, dayNumber uint64) (success bool, successfulUnbondings []string, failedUnbondings []string)
- func (k Keeper) InterchainAccountFromAddress(goCtx context.Context, req *types.QueryInterchainAccountFromAddressRequest) (*types.QueryInterchainAccountFromAddressResponse, error)
- func (k Keeper) IsRedemptionRateWithinSafetyBounds(ctx sdk.Context, zone types.HostZone) (bool, error)
- func (k Keeper) IsWithinBufferWindow(ctx sdk.Context) (bool, error)
- func (k Keeper) IterateHostZones(ctx sdk.Context, ...)
- func (k Keeper) LiquidStakeRewardCollectorBalance(ctx sdk.Context, msgSvr types.MsgServer) bool
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MarshalClaimCallbackArgs(ctx sdk.Context, claimCallback types.ClaimCallback) ([]byte, error)
- func (k Keeper) MarshalDelegateCallbackArgs(ctx sdk.Context, delegateCallback types.DelegateCallback) ([]byte, error)
- func (k Keeper) MarshalRebalanceCallbackArgs(ctx sdk.Context, rebalanceCallback types.RebalanceCallback) ([]byte, error)
- func (k Keeper) MarshalRedemptionCallbackArgs(ctx sdk.Context, redemptionCallback types.RedemptionCallback) ([]byte, error)
- func (k Keeper) MarshalReinvestCallbackArgs(ctx sdk.Context, reinvestCallback types.ReinvestCallback) ([]byte, error)
- func (k Keeper) MarshalUndelegateCallbackArgs(ctx sdk.Context, undelegateCallback types.UndelegateCallback) ([]byte, error)
- func (k Keeper) ModuleAddress(goCtx context.Context, req *types.QueryModuleAddressRequest) (*types.QueryModuleAddressResponse, error)
- func (k Keeper) NextPacketSequence(c context.Context, req *types.QueryGetNextPacketSequenceRequest) (*types.QueryGetNextPacketSequenceResponse, error)
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) QueryDelegationsIcq(ctx sdk.Context, hostZone types.HostZone, valoper string) error
- func (k Keeper) QueryValidatorExchangeRate(ctx sdk.Context, msg *types.MsgUpdateValidatorSharesExchRate) (*types.MsgUpdateValidatorSharesExchRateResponse, error)
- func (k Keeper) ReinvestRewards(ctx sdk.Context)
- func (k Keeper) RemoveEpochTracker(ctx sdk.Context, epochIdentifier string)
- func (k Keeper) RemoveHostZone(ctx sdk.Context, chain_id string)
- func (k Keeper) RemoveValidatorFromHostZone(ctx sdk.Context, chainId string, validatorAddress string) error
- func (k Keeper) SetEpochTracker(ctx sdk.Context, epochTracker types.EpochTracker)
- func (k *Keeper) SetHooks(gh types.StakeIBCHooks) *Keeper
- func (k Keeper) SetHostZone(ctx sdk.Context, hostZone types.HostZone)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetWithdrawalAddress(ctx sdk.Context)
- func (k Keeper) SetWithdrawalAddressOnHost(ctx sdk.Context, hostZone types.HostZone) error
- func (k Keeper) StakeExistingDepositsOnHostZones(ctx sdk.Context, epochNumber uint64, ...)
- func (k Keeper) SubmitHostZoneUnbondingMsg(ctx sdk.Context, msgs []proto.Message, totalAmtToUnbond sdkmath.Int, ...) error
- func (k Keeper) SubmitTxs(ctx sdk.Context, connectionId string, msgs []proto.Message, ...) (uint64, error)
- func (k Keeper) SubmitTxsDayEpoch(ctx sdk.Context, connectionId string, msgs []proto.Message, ...) (uint64, error)
- func (k Keeper) SubmitTxsEpoch(ctx sdk.Context, connectionId string, msgs []proto.Message, ...) (uint64, error)
- func (k Keeper) SubmitTxsStrideEpoch(ctx sdk.Context, connectionId string, msgs []proto.Message, ...) (uint64, error)
- func (k Keeper) SweepAllUnbondedTokens(ctx sdk.Context) (success bool, successfulSweeps []string, sweepAmounts []sdkmath.Int, ...)
- func (k Keeper) SweepAllUnbondedTokensForHostZone(ctx sdk.Context, hostZone types.HostZone, ...) (success bool, sweepAmount sdkmath.Int)
- func (k Keeper) SweepStTokensFromRewardCollToFeeColl(ctx sdk.Context) error
- func (k Keeper) TransferExistingDepositsToHostZones(ctx sdk.Context, epochNumber uint64, ...)
- func (k Keeper) UnmarshalClaimCallbackArgs(ctx sdk.Context, claimCallback []byte) (*types.ClaimCallback, error)
- func (k Keeper) UnmarshalDelegateCallbackArgs(ctx sdk.Context, delegateCallback []byte) (*types.DelegateCallback, error)
- func (k Keeper) UnmarshalRebalanceCallbackArgs(ctx sdk.Context, rebalanceCallback []byte) (*types.RebalanceCallback, error)
- func (k Keeper) UnmarshalRedemptionCallbackArgs(ctx sdk.Context, redemptionCallback []byte) (types.RedemptionCallback, error)
- func (k Keeper) UnmarshalReinvestCallbackArgs(ctx sdk.Context, reinvestCallback []byte) (*types.ReinvestCallback, error)
- func (k Keeper) UnmarshalUndelegateCallbackArgs(ctx sdk.Context, undelegateCallback []byte) (types.UndelegateCallback, error)
- func (k Keeper) UpdateDelegationBalances(ctx sdk.Context, zone types.HostZone, ...) error
- func (k Keeper) UpdateEpochTracker(ctx sdk.Context, epochInfo epochstypes.EpochInfo) (epochNumber uint64, err error)
- func (k Keeper) UpdateHostZoneUnbondings(ctx sdk.Context, latestCompletionTime time.Time, chainId string, ...) (stTokenBurnAmount sdkmath.Int, err error)
- func (k Keeper) UpdateRedemptionRates(ctx sdk.Context, depositRecords []recordstypes.DepositRecord)
- func (k Keeper) UpdateWithdrawalBalance(ctx sdk.Context, hostZone types.HostZone) error
- func (k Keeper) Validators(c context.Context, req *types.QueryGetValidatorsRequest) (*types.QueryGetValidatorsResponse, error)
Constants ¶
const ( ICACallbackID_Delegate = "delegate" ICACallbackID_Claim = "claim" ICACallbackID_Undelegate = "undelegate" ICACallbackID_Reinvest = "reinvest" ICACallbackID_Redemption = "redemption" ICACallbackID_Rebalance = "rebalance" )
const ( ICQCallbackID_WithdrawalBalance = "withdrawalbalance" ICQCallbackID_FeeBalance = "feebalance" ICQCallbackID_Delegation = "delegation" ICQCallbackID_Validator = "validator" )
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the stakeibc module
func ClaimCallback ¶ added in v12.1.0
func ClaimCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
ICA Callback after claiming unbonded tokens
If successful: * Removes the user redemption record If timeout/failure: * Reverts pending flag in the user redemption record so the claim can be re-tried
func DelegateCallback ¶ added in v12.1.0
func DelegateCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
ICA Callback after delegating deposit records
If successful: * Updates deposit record status and records delegation changes on the host zone and validators If timeout: * Does nothing If failure: * Reverts deposit record status
func DelegatorSharesCallback ¶
DelegatorSharesCallback is a callback handler for UpdateValidatorSharesExchRate queries.
In an attempt to get the ICA's delegation amount on a given validator, we have to query:
- the validator's internal exchange rate
- the Delegation ICA's delegated shares And apply the following equation: num_tokens = exchange_rate * num_shares
This is the callback from query #2
Note: for now, to get proofs in your ICQs, you need to query the entire store on the host zone! e.g. "store/bank/key"
func FeeBalanceCallback ¶
FeeBalanceCallback is a callback handler for FeeBalnce queries. The query response will return the fee account balance If the balance is non-zero, an ICA MsgTransfer is initated to the RewardsCollector account Note: for now, to get proofs in your ICQs, you need to query the entire store on the host zone! e.g. "store/bank/key"
func GetValidatorFromAddress ¶
func GetValidatorFromAddress(validators []*types.Validator, address string) (val types.Validator, index int64, found bool)
Get a validator and its index from a list of validators, by address
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
func RebalanceCallback ¶ added in v12.1.0
func RebalanceCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
ICA Callback after rebalance validators on a host zone
If successful: * Updates relevant validator delegations on the host zone struct If timeout/failure: * Does nothing
func RedemptionCallback ¶ added in v12.1.0
func RedemptionCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
ICA Callback after undelegating
If successful: * Updates epoch unbonding record status If timeout: * Does nothing If failure: * Reverts epoch unbonding record status
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers all governance invariants.
func ReinvestCallback ¶ added in v12.1.0
func ReinvestCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
ICA Callback after reinvestment
If successful: * Creates a new DepositRecord with the reinvestment amount * Issues an ICQ to query the rewards balance If timeout/failure: * Does nothing
func UndelegateCallback ¶ added in v12.1.0
func UndelegateCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
ICA Callback after undelegating
If successful: * Updates epoch unbonding record status * Records delegation changes on the host zone and validators, * Burns stTokens If timeout: * Does nothing If failure: * Reverts epoch unbonding record status
func ValidatorExchangeRateCallback ¶
func ValidatorExchangeRateCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
ValidatorCallback is a callback handler for validator queries.
In an attempt to get the ICA's delegation amount on a given validator, we have to query:
- the validator's internal exchange rate
- the Delegation ICA's delegated shares And apply the following equation: num_tokens = exchange_rate * num_shares
This is the callback from query #1
func WithdrawalBalanceCallback ¶
WithdrawalBalanceCallback is a callback handler for WithdrawalBalance queries. The query response will return the withdrawal account balance If the balance is non-zero, ICA MsgSends are submitted to transfer from the withdrawal account to the delegation account (for reinvestment) and fee account (for commission)
Note: for now, to get proofs in your ICQs, you need to query the entire store on the host zone! e.g. "store/bank/key"
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Hooks wrapper struct for incentives keeper
func (Hooks) AfterEpochEnd ¶
func (h Hooks) AfterEpochEnd(ctx sdk.Context, epochInfo epochstypes.EpochInfo)
func (Hooks) BeforeEpochStart ¶
func (h Hooks) BeforeEpochStart(ctx sdk.Context, epochInfo epochstypes.EpochInfo)
epochs hooks
type ICACallback ¶ added in v12.1.0
type ICACallback func(Keeper, sdk.Context, channeltypes.Packet, *icacallbackstypes.AcknowledgementResponse, []byte) error
ICACallbacks wrapper struct for stakeibc keeper
type ICACallbacks ¶ added in v12.1.0
type ICACallbacks struct {
// contains filtered or unexported fields
}
func (ICACallbacks) AddICACallback ¶ added in v12.1.0
func (c ICACallbacks) AddICACallback(id string, fn interface{}) icacallbackstypes.ICACallbackHandler
func (ICACallbacks) CallICACallback ¶ added in v12.1.0
func (c ICACallbacks) CallICACallback(ctx sdk.Context, id string, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
func (ICACallbacks) HasICACallback ¶ added in v12.1.0
func (c ICACallbacks) HasICACallback(id string) bool
func (ICACallbacks) RegisterICACallbacks ¶ added in v12.1.0
func (c ICACallbacks) RegisterICACallbacks() icacallbackstypes.ICACallbackHandler
type ICQCallback ¶
ICQCallbacks wrapper struct for stakeibc keeper
type ICQCallbacks ¶
type ICQCallbacks struct {
// contains filtered or unexported fields
}
func (ICQCallbacks) AddICQCallback ¶
func (c ICQCallbacks) AddICQCallback(id string, fn interface{}) icqtypes.QueryCallbacks
func (ICQCallbacks) CallICQCallback ¶
func (ICQCallbacks) HasICQCallback ¶
func (c ICQCallbacks) HasICQCallback(id string) bool
func (ICQCallbacks) RegisterICQCallbacks ¶
func (c ICQCallbacks) RegisterICQCallbacks() icqtypes.QueryCallbacks
type Keeper ¶
type Keeper struct { ICAControllerKeeper icacontrollerkeeper.Keeper IBCKeeper ibckeeper.Keeper InterchainQueryKeeper icqkeeper.Keeper RecordsKeeper recordsmodulekeeper.Keeper StakingKeeper stakingkeeper.Keeper ICACallbacksKeeper icacallbackskeeper.Keeper AccountKeeper types.AccountKeeper RatelimitKeeper types.RatelimitKeeper // contains filtered or unexported fields }
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, ps paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper bankkeeper.Keeper, icacontrollerkeeper icacontrollerkeeper.Keeper, ibcKeeper ibckeeper.Keeper, interchainQueryKeeper icqkeeper.Keeper, RecordsKeeper recordsmodulekeeper.Keeper, StakingKeeper stakingkeeper.Keeper, ICACallbacksKeeper icacallbackskeeper.Keeper, RatelimitKeeper types.RatelimitKeeper, ) Keeper
func (Keeper) AddDelegationToValidator ¶
func (Keeper) AddValidatorToHostZone ¶
func (k Keeper) AddValidatorToHostZone(ctx sdk.Context, chainId string, validator types.Validator, fromGovernance bool) error
Appends a validator to host zone (if the host zone is not already at capacity) If the validator is added through governance, the weight is equal to the minimum weight across the set If the validator is added through an admin transactions, the weight is specified in the message
func (Keeper) AddValidatorsProposal ¶
func (Keeper) AddressUnbondings ¶
func (k Keeper) AddressUnbondings(c context.Context, req *types.QueryAddressUnbondings) (*types.QueryAddressUnbondingsResponse, error)
func (Keeper) AfterEpochEnd ¶
func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochInfo epochstypes.EpochInfo)
func (Keeper) AllocateHostZoneReward ¶
(1) liquid stake reward collector balance, then (2) sweet stTokens from reward collector to fee collector
func (Keeper) BeforeEpochStart ¶
func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochInfo epochstypes.EpochInfo)
func (Keeper) BurnTokens ¶
func (k Keeper) BurnTokens(ctx sdk.Context, hostZone types.HostZone, stTokenBurnAmount sdkmath.Int) error
Burn stTokens after they've been unbonded
func (Keeper) CheckIsStToken ¶
Validate whether a denom is a supported liquid staking token
func (Keeper) CleanupEpochUnbondingRecords ¶
Deletes any epoch unbonding records that have had all unbondings claimed
func (Keeper) ConfirmValSetHasSpace ¶
Check the max number of validators to confirm we won't exceed it when adding a new validator Types of additions:
- change a weight from zero to non-zero
- add a new validator with non-zero weight
func (Keeper) CreateDepositRecordsForEpoch ¶
Create a new deposit record for each host zone for the given epoch
func (Keeper) CreateEpochUnbondingRecord ¶
func (Keeper) DecrementHostZoneUnbonding ¶
func (k Keeper) DecrementHostZoneUnbonding(ctx sdk.Context, userRedemptionRecord recordstypes.UserRedemptionRecord, callbackArgs types.ClaimCallback) error
After a user claims their unbonded tokens, the claim amount is decremented from the corresponding host zone unbonding record
func (Keeper) DelegateOnHost ¶
func (k Keeper) DelegateOnHost(ctx sdk.Context, hostZone types.HostZone, amt sdk.Coin, depositRecord recordstypes.DepositRecord) error
func (Keeper) EpochTracker ¶
func (k Keeper) EpochTracker(c context.Context, req *types.QueryGetEpochTrackerRequest) (*types.QueryGetEpochTrackerResponse, error)
func (Keeper) EpochTrackerAll ¶
func (k Keeper) EpochTrackerAll(c context.Context, req *types.QueryAllEpochTrackerRequest) (*types.QueryAllEpochTrackerResponse, error)
func (Keeper) GetAllActiveHostZone ¶
GetAllActiveHostZone returns all hostZones that are active (halted = false)
func (Keeper) GetAllEpochTracker ¶
func (k Keeper) GetAllEpochTracker(ctx sdk.Context) (list []types.EpochTracker)
GetAllEpochTracker returns all epochTracker
func (Keeper) GetAllHostZone ¶
GetAllHostZone returns all hostZone
func (Keeper) GetChainID ¶
func (Keeper) GetClaimableRedemptionRecord ¶
func (k Keeper) GetClaimableRedemptionRecord(ctx sdk.Context, msg *types.MsgClaimUndelegatedTokens) (*recordstypes.UserRedemptionRecord, error)
func (Keeper) GetConnectionId ¶
func (Keeper) GetCounterpartyChainId ¶
func (Keeper) GetEpochTracker ¶
func (k Keeper) GetEpochTracker( ctx sdk.Context, epochIdentifier string, ) (val types.EpochTracker, found bool)
GetEpochTracker returns a epochTracker from its index
func (Keeper) GetHostZone ¶
GetHostZone returns a hostZone from its id
func (Keeper) GetHostZoneFromHostDenom ¶
GetHostZoneFromHostDenom returns a HostZone from a HostDenom
func (Keeper) GetHostZoneFromIBCDenom ¶
GetHostZoneFromIBCDenom returns a HostZone from a IBCDenom
func (Keeper) GetHostZoneFromTransferChannelID ¶
func (k Keeper) GetHostZoneFromTransferChannelID(ctx sdk.Context, channelID string) (hostZone types.HostZone, found bool)
GetHostZoneFromTransferChannelID returns a HostZone from a transfer channel ID
func (Keeper) GetHostZoneUnbondingMsgs ¶
func (k Keeper) GetHostZoneUnbondingMsgs(ctx sdk.Context, hostZone types.HostZone) (msgs []proto.Message, totalAmountToUnbond sdkmath.Int, marshalledCallbackArgs []byte, epochUnbondingRecordIds []uint64, err error)
Build the undelegation messages for each validator by summing the total amount to unbond across epoch unbonding record, and then splitting the undelegation amount across validators
returns
(1) MsgUndelegate messages (2) Total Amount to unbond across all validators (3) Marshalled Callback Args (4) Relevant EpochUnbondingRecords that contain HostZoneUnbondings that are ready for unbonding
func (Keeper) GetICATimeoutNanos ¶
func (Keeper) GetLatestCompletionTime ¶
Get the latest completion time across each MsgUndelegate in the ICA transaction The time is used to set the
func (Keeper) GetLightClientHeightSafely ¶
func (Keeper) GetLightClientTimeSafely ¶
func (Keeper) GetModuleAccountBalance ¶
func (k Keeper) GetModuleAccountBalance(hostZone types.HostZone, depositRecords []recordstypes.DepositRecord) sdkmath.Int
func (Keeper) GetRedemptionAccount ¶
func (Keeper) GetRedemptionTransferMsg ¶
func (k Keeper) GetRedemptionTransferMsg(ctx sdk.Context, userRedemptionRecord *recordstypes.UserRedemptionRecord, hostZoneId string) (*IcaTx, error)
func (Keeper) GetStartTimeNextEpoch ¶
helper to get time at which next epoch begins, in unix nano units
func (Keeper) GetStrideEpochElapsedShare ¶
helper to get what share of the curr epoch we're through
func (Keeper) GetTargetValAmtsForHostZone ¶
func (k Keeper) GetTargetValAmtsForHostZone(ctx sdk.Context, hostZone types.HostZone, finalDelegation sdkmath.Int) (map[string]sdkmath.Int, error)
This will get the target validator delegation for the given hostZone such that the total validator delegation is equal to the finalDelegation output key is ADDRESS not NAME
func (Keeper) GetTotalValidatorDelegations ¶
func (Keeper) GetTotalValidatorWeight ¶
func (Keeper) GetUndelegatedBalance ¶
func (k Keeper) GetUndelegatedBalance(hostZone types.HostZone, depositRecords []recordstypes.DepositRecord) sdkmath.Int
func (Keeper) GetValidatorDelegationAmtDifferences ¶
func (k Keeper) GetValidatorDelegationAmtDifferences(ctx sdk.Context, hostZone types.HostZone) (map[string]sdkmath.Int, error)
This function returns a map from Validator Address to how many extra tokens need to be given to that validator
positive implies extra tokens need to be given, negative impleis tokens need to be taken away
func (Keeper) HostZone ¶
func (k Keeper) HostZone(c context.Context, req *types.QueryGetHostZoneRequest) (*types.QueryGetHostZoneResponse, error)
func (Keeper) HostZoneAll ¶
func (k Keeper) HostZoneAll(c context.Context, req *types.QueryAllHostZoneRequest) (*types.QueryAllHostZoneResponse, error)
func (Keeper) ICACallbackHandler ¶ added in v12.1.0
func (k Keeper) ICACallbackHandler() ICACallbacks
func (Keeper) ICQCallbackHandler ¶
func (k Keeper) ICQCallbackHandler() ICQCallbacks
func (Keeper) InitiateAllHostZoneUnbondings ¶
func (k Keeper) InitiateAllHostZoneUnbondings(ctx sdk.Context, dayNumber uint64) (success bool, successfulUnbondings []string, failedUnbondings []string)
this function iterates each host zone, and if it's the right time to initiate an unbonding, it attempts to unbond all outstanding records returns (1) did all chains succeed
(2) list of strings of successful unbondings (3) list of strings of failed unbondings
func (Keeper) InterchainAccountFromAddress ¶
func (k Keeper) InterchainAccountFromAddress(goCtx context.Context, req *types.QueryInterchainAccountFromAddressRequest) (*types.QueryInterchainAccountFromAddressResponse, error)
InterchainAccountFromAddress implements the Query/InterchainAccountFromAddress gRPC method
func (Keeper) IsRedemptionRateWithinSafetyBounds ¶
func (k Keeper) IsRedemptionRateWithinSafetyBounds(ctx sdk.Context, zone types.HostZone) (bool, error)
safety check: ensure the redemption rate is NOT below our min safety threshold && NOT above our max safety threshold on host zone
func (Keeper) IsWithinBufferWindow ¶
helper to check whether ICQs are valid in this portion of the epoch
func (Keeper) IterateHostZones ¶
func (k Keeper) IterateHostZones(ctx sdk.Context, fn func(ctx sdk.Context, index int64, zoneInfo types.HostZone) error)
IterateHostZones iterates zones
func (Keeper) LiquidStakeRewardCollectorBalance ¶
Liquid Stake Reward Collector Balance
func (Keeper) MarshalClaimCallbackArgs ¶
func (k Keeper) MarshalClaimCallbackArgs(ctx sdk.Context, claimCallback types.ClaimCallback) ([]byte, error)
Marshal claim callback args
func (Keeper) MarshalDelegateCallbackArgs ¶
func (k Keeper) MarshalDelegateCallbackArgs(ctx sdk.Context, delegateCallback types.DelegateCallback) ([]byte, error)
Marshalls delegate callback arguments
func (Keeper) MarshalRebalanceCallbackArgs ¶
func (k Keeper) MarshalRebalanceCallbackArgs(ctx sdk.Context, rebalanceCallback types.RebalanceCallback) ([]byte, error)
Marshalls rebalance callback arguments
func (Keeper) MarshalRedemptionCallbackArgs ¶
func (k Keeper) MarshalRedemptionCallbackArgs(ctx sdk.Context, redemptionCallback types.RedemptionCallback) ([]byte, error)
Marshalls redemption callback arguments
func (Keeper) MarshalReinvestCallbackArgs ¶
func (k Keeper) MarshalReinvestCallbackArgs(ctx sdk.Context, reinvestCallback types.ReinvestCallback) ([]byte, error)
Marshalls reinvest callback arguments
func (Keeper) MarshalUndelegateCallbackArgs ¶
func (k Keeper) MarshalUndelegateCallbackArgs(ctx sdk.Context, undelegateCallback types.UndelegateCallback) ([]byte, error)
Marshal undelegate callback args
func (Keeper) ModuleAddress ¶
func (k Keeper) ModuleAddress(goCtx context.Context, req *types.QueryModuleAddressRequest) (*types.QueryModuleAddressResponse, error)
func (Keeper) NextPacketSequence ¶
func (k Keeper) NextPacketSequence(c context.Context, req *types.QueryGetNextPacketSequenceRequest) (*types.QueryGetNextPacketSequenceResponse, error)
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) QueryDelegationsIcq ¶
Submits an ICQ to get a validator's delegations This is called after the validator's exchange rate is determined
func (Keeper) QueryValidatorExchangeRate ¶
func (k Keeper) QueryValidatorExchangeRate(ctx sdk.Context, msg *types.MsgUpdateValidatorSharesExchRate) (*types.MsgUpdateValidatorSharesExchRateResponse, error)
Submits an ICQ to get a validator's exchange rate
func (Keeper) ReinvestRewards ¶
func (Keeper) RemoveEpochTracker ¶
RemoveEpochTracker removes a epochTracker from the store
func (Keeper) RemoveHostZone ¶
RemoveHostZone removes a hostZone from the store
func (Keeper) RemoveValidatorFromHostZone ¶
func (k Keeper) RemoveValidatorFromHostZone(ctx sdk.Context, chainId string, validatorAddress string) error
Removes a validator from a host zone The validator must be zero-weight and have no delegations in order to be removed
func (Keeper) SetEpochTracker ¶
func (k Keeper) SetEpochTracker(ctx sdk.Context, epochTracker types.EpochTracker)
SetEpochTracker set a specific epochTracker in the store from its index
func (*Keeper) SetHooks ¶
func (k *Keeper) SetHooks(gh types.StakeIBCHooks) *Keeper
SetHooks sets the hooks for ibc staking
func (Keeper) SetHostZone ¶
SetHostZone set a specific hostZone in the store
func (Keeper) SetWithdrawalAddress ¶
Set the withdrawal account address for each host zone
func (Keeper) SetWithdrawalAddressOnHost ¶
func (Keeper) StakeExistingDepositsOnHostZones ¶
func (k Keeper) StakeExistingDepositsOnHostZones(ctx sdk.Context, epochNumber uint64, depositRecords []recordstypes.DepositRecord)
Iterate each deposit record marked DELEGATION_QUEUE and use the delegation ICA to delegate on the host zone
func (Keeper) SubmitHostZoneUnbondingMsg ¶
func (k Keeper) SubmitHostZoneUnbondingMsg(ctx sdk.Context, msgs []proto.Message, totalAmtToUnbond sdkmath.Int, marshalledCallbackArgs []byte, hostZone types.HostZone) error
Submit MsgUndelegate ICA transactions across validators
func (Keeper) SubmitTxs ¶
func (k Keeper) SubmitTxs( ctx sdk.Context, connectionId string, msgs []proto.Message, account types.ICAAccount, timeoutTimestamp uint64, callbackId string, callbackArgs []byte, ) (uint64, error)
SubmitTxs submits an ICA transaction containing multiple messages
func (Keeper) SubmitTxsDayEpoch ¶
func (Keeper) SubmitTxsEpoch ¶
func (Keeper) SubmitTxsStrideEpoch ¶
func (Keeper) SweepAllUnbondedTokens ¶
func (k Keeper) SweepAllUnbondedTokens(ctx sdk.Context) (success bool, successfulSweeps []string, sweepAmounts []sdkmath.Int, failedSweeps []string)
Sends all unbonded tokens to the redemption account returns:
- success indicator if all chains succeeded
- list of successful chains
- list of tokens swept
- list of failed chains
func (Keeper) SweepAllUnbondedTokensForHostZone ¶
func (k Keeper) SweepAllUnbondedTokensForHostZone(ctx sdk.Context, hostZone types.HostZone, epochUnbondingRecords []recordstypes.EpochUnbondingRecord) (success bool, sweepAmount sdkmath.Int)
Batch transfers any unbonded tokens from the delegation account to the redemption account
func (Keeper) SweepStTokensFromRewardCollToFeeColl ¶
Sweep stTokens from Reward Collector to Fee Collector
func (Keeper) TransferExistingDepositsToHostZones ¶
func (k Keeper) TransferExistingDepositsToHostZones(ctx sdk.Context, epochNumber uint64, depositRecords []recordstypes.DepositRecord)
Iterate each deposit record marked TRANSFER_QUEUE and IBC transfer tokens from the Stride controller account to the delegation ICAs on each host zone
func (Keeper) UnmarshalClaimCallbackArgs ¶
func (k Keeper) UnmarshalClaimCallbackArgs(ctx sdk.Context, claimCallback []byte) (*types.ClaimCallback, error)
Unmarshalls claim callback arguments into a ClaimCallback struct
func (Keeper) UnmarshalDelegateCallbackArgs ¶
func (k Keeper) UnmarshalDelegateCallbackArgs(ctx sdk.Context, delegateCallback []byte) (*types.DelegateCallback, error)
Unmarshalls delegate callback arguments into a DelegateCallback struct
func (Keeper) UnmarshalRebalanceCallbackArgs ¶
func (k Keeper) UnmarshalRebalanceCallbackArgs(ctx sdk.Context, rebalanceCallback []byte) (*types.RebalanceCallback, error)
Unmarshalls rebalance callback arguments into a RebalanceCallback struct
func (Keeper) UnmarshalRedemptionCallbackArgs ¶
func (k Keeper) UnmarshalRedemptionCallbackArgs(ctx sdk.Context, redemptionCallback []byte) (types.RedemptionCallback, error)
Unmarshalls redemption callback arguments into a RedemptionCallback struct
func (Keeper) UnmarshalReinvestCallbackArgs ¶
func (k Keeper) UnmarshalReinvestCallbackArgs(ctx sdk.Context, reinvestCallback []byte) (*types.ReinvestCallback, error)
Unmarshalls reinvest callback arguments into a ReinvestCallback struct
func (Keeper) UnmarshalUndelegateCallbackArgs ¶
func (k Keeper) UnmarshalUndelegateCallbackArgs(ctx sdk.Context, undelegateCallback []byte) (types.UndelegateCallback, error)
Unmarshalls undelegate callback arguments into a UndelegateCallback struct
func (Keeper) UpdateDelegationBalances ¶
func (k Keeper) UpdateDelegationBalances(ctx sdk.Context, zone types.HostZone, undelegateCallback types.UndelegateCallback) error
Decrement the stakedBal field on the host zone and each validator's delegations after a successful unbonding ICA
func (Keeper) UpdateEpochTracker ¶
func (k Keeper) UpdateEpochTracker(ctx sdk.Context, epochInfo epochstypes.EpochInfo) (epochNumber uint64, err error)
Update the epoch information in the stakeibc epoch tracker
func (Keeper) UpdateHostZoneUnbondings ¶
func (k Keeper) UpdateHostZoneUnbondings( ctx sdk.Context, latestCompletionTime time.Time, chainId string, undelegateCallback types.UndelegateCallback, ) (stTokenBurnAmount sdkmath.Int, err error)
UpdateHostZoneUnbondings does two things:
- Update the time of each hostZoneUnbonding on each epochUnbondingRecord
- Return the number of stTokens that need to be burned
func (Keeper) UpdateRedemptionRates ¶
func (k Keeper) UpdateRedemptionRates(ctx sdk.Context, depositRecords []recordstypes.DepositRecord)
Updates the redemption rate for each host zone The redemption rate equation is:
(Unbonded Balance + Staked Balance + Module Account Balance) / (stToken Supply)
func (Keeper) UpdateWithdrawalBalance ¶
Submits an ICQ for the withdrawal account balance
func (Keeper) Validators ¶
func (k Keeper) Validators(c context.Context, req *types.QueryGetValidatorsRequest) (*types.QueryGetValidatorsResponse, error)
Source Files ¶
- deposit_records.go
- epoch_tracker.go
- gov.go
- grpc_query.go
- grpc_query_address_unbondings.go
- grpc_query_epoch_tracker.go
- grpc_query_host_zone.go
- grpc_query_module_address.go
- grpc_query_next_packet_sequence.go
- grpc_query_params.go
- grpc_query_register_ica.go
- grpc_query_validator.go
- hooks.go
- host_zone.go
- icacallbacks.go
- icacallbacks_claim.go
- icacallbacks_delegate.go
- icacallbacks_rebalance.go
- icacallbacks_redemption.go
- icacallbacks_reinvest.go
- icacallbacks_undelegate.go
- icqcallbacks.go
- icqcallbacks_delegator_shares.go
- icqcallbacks_fee_balance.go
- icqcallbacks_validator_exchange_rate.go
- icqcallbacks_withdrawal_balance.go
- invariants.go
- keeper.go
- msg_server.go
- msg_server_add_validators.go
- msg_server_change_validator_weight.go
- msg_server_claim_undelegated_tokens.go
- msg_server_clear_balance.go
- msg_server_delete_validator.go
- msg_server_liquid_stake.go
- msg_server_rebalance_validators.go
- msg_server_redeem_stake.go
- msg_server_register_host_zone.go
- msg_server_restore_interchain_account.go
- msg_server_submit_tx.go
- msg_server_update_validator_shares_exch_rate.go
- params.go
- reward_allocation.go
- unbonding_records.go
- validator_selection.go