Documentation ¶
Index ¶
- Constants
- Variables
- func AllInvariants(k Keeper) sdk.Invariant
- func AssertTwapAssetsMatchTradeRoute(twapRecord types.OsmosisTwapRecord, tradeRoute types.TradeRoute) error
- func CalibrateDelegationCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- func CommunityPoolIcaBalanceCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- func DelegatorSharesCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- func EmitFailedLSMLiquidStakeEvent(ctx sdk.Context, hostZone types.HostZone, ...)
- func EmitPendingLSMLiquidStakeEvent(ctx sdk.Context, hostZone types.HostZone, ...)
- func EmitSuccessfulLSMLiquidStakeEvent(ctx sdk.Context, hostZone types.HostZone, ...)
- func EmitSuccessfulLiquidStakeEvent(ctx sdk.Context, msg *types.MsgLiquidStake, hostZone types.HostZone, ...)
- func EmitUndelegationEvent(ctx sdk.Context, hostZone types.HostZone, totalUnbondAmount sdkmath.Int)
- func EmitValidatorSharesToTokensRateChangeEvent(ctx sdk.Context, chainId string, validatorAddress string, ...)
- func EmitValidatorSlashEvent(ctx sdk.Context, hostZone types.HostZone, validatorAddress string, ...)
- func FeeBalanceCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- func GetLSMTokenDepositId(blockHeight int64, chainId, stakerAddress, denom string) string
- func GetValidatorFromAddress(validators []*types.Validator, address string) (val types.Validator, index int64, found bool)
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func PoolPriceCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func TradeConvertedBalanceCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- func TradeRewardBalanceCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- func ValidatorSharesToTokensRateCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- func WithdrawalBalanceCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- func WithdrawalRewardBalanceCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
- type ForwardMetadata
- type Hooks
- 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, ...) error
- 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) AllTradeRoutes(c context.Context, req *types.QueryAllTradeRoutes) (*types.QueryAllTradeRoutesResponse, error)
- func (k Keeper) AllocateHostZoneReward(ctx sdk.Context)
- func (k Keeper) AssertStrideAndDayEpochRelationship(ctx sdk.Context)
- func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochInfo epochstypes.EpochInfo)
- func (k Keeper) BeginBlocker(ctx sdk.Context)
- func (k Keeper) BuildHostToTradeTransferMsg(ctx sdk.Context, amount sdkmath.Int, route types.TradeRoute) (msg transfertypes.MsgTransfer, err error)
- func (k Keeper) BuildSwapMsg(rewardAmount sdkmath.Int, route types.TradeRoute) (msg types.MsgSwapExactAmountIn, err error)
- func (k Keeper) BurnTokens(ctx sdk.Context, hostZone types.HostZone, stTokenBurnAmount sdkmath.Int) error
- func (k Keeper) CalculateLSMStToken(liquidStakedShares sdkmath.Int, lsmLiquidStake types.LSMLiquidStake) sdk.Coin
- func (k Keeper) Callbacks() icacallbackstypes.ModuleCallbacks
- func (k Keeper) CheckDelegationChangedDuringQuery(ctx sdk.Context, validator types.Validator, ...) (overlapped bool, err error)
- func (k Keeper) CheckForSlash(ctx sdk.Context, hostZone types.HostZone, valIndex int64, ...) (validatorWasSlashed bool, delegatedTokens sdkmath.Int, err error)
- func (k Keeper) CheckIfValidatorWasSlashed(ctx sdk.Context, hostZone types.HostZone, ...) (validatorWasSlashed bool, err error)
- func (k Keeper) CheckIsStToken(ctx sdk.Context, denom string) bool
- func (k Keeper) CheckValidatorWeightsBelowCap(ctx sdk.Context, validators []*types.Validator) error
- func (k Keeper) ClaimAccruedStakingRewards(ctx sdk.Context)
- func (k Keeper) ClaimAccruedStakingRewardsOnHost(ctx sdk.Context, hostZone types.HostZone) error
- func (k Keeper) ClaimCallback(ctx sdk.Context, packet channeltypes.Packet, ...) error
- func (k Keeper) CleanupEpochUnbondingRecords(ctx sdk.Context, epochNumber uint64) bool
- func (k Keeper) ConsolidateUnbondingMessages(totalUnbondAmount sdkmath.Int, initialUnbondings []*types.SplitDelegation, ...) (finalUnbondings []*types.SplitDelegation, err 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) DecrementValidatorDelegationChangesInProgress(hostZone *types.HostZone, validatorAddress string) error
- func (k Keeper) DelegateCallback(ctx sdk.Context, packet channeltypes.Packet, ...) error
- func (k Keeper) DelegateOnHost(ctx sdk.Context, hostZone types.HostZone, amt sdk.Coin, ...) error
- func (k Keeper) DetokenizeAllLSMDeposits(ctx sdk.Context)
- func (k Keeper) DetokenizeCallback(ctx sdk.Context, packet channeltypes.Packet, ...) error
- func (k Keeper) DetokenizeLSMDeposit(ctx sdk.Context, hostZone types.HostZone, deposit recordstypes.LSMTokenDeposit) error
- func (k Keeper) DisableHubTokenization(ctx sdk.Context)
- func (k Keeper) EndBlocker(ctx sdk.Context)
- 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) FailLSMLiquidStake(ctx sdk.Context, hostZone types.HostZone, lsmLiquidStake types.LSMLiquidStake, ...)
- func (k Keeper) FinishLSMLiquidStake(ctx sdk.Context, lsmLiquidStake types.LSMLiquidStake, async bool) error
- func (k Keeper) FundCommunityPool(ctx sdk.Context, hostZone types.HostZone, token sdk.Coin) error
- func (k Keeper) GetActiveHostZone(ctx sdk.Context, chainId string) (hostZone types.HostZone, err 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) GetAllTradeRoutes(ctx sdk.Context) (list []types.TradeRoute)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetChainIdFromConnectionId(ctx sdk.Context, connectionID string) (string, error)
- func (k Keeper) GetClaimableRedemptionRecord(ctx sdk.Context, msg *types.MsgClaimUndelegatedTokens) (*recordstypes.UserRedemptionRecord, error)
- func (k Keeper) GetConnectionIdFromICAPortId(ctx sdk.Context, portId string) (connectionId string, found bool)
- func (k Keeper) GetDepositAccountBalance(chainId string, depositRecords []recordstypes.DepositRecord) sdk.Dec
- func (k Keeper) GetEpochTracker(ctx sdk.Context, epochIdentifier string) (val types.EpochTracker, found bool)
- func (k Keeper) GetHostZone(ctx sdk.Context, chainId 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) GetHostZoneFromLSMTokenPath(ctx sdk.Context, path string) (types.HostZone, error)
- func (k Keeper) GetHostZoneFromTransferChannelID(ctx sdk.Context, channelID string) (hostZone types.HostZone, found bool)
- func (k Keeper) GetICATimeoutNanos(ctx sdk.Context, epochType string) (uint64, error)
- func (k Keeper) GetInnerSafetyBounds(ctx sdk.Context, zone types.HostZone) (sdk.Dec, sdk.Dec)
- func (k Keeper) GetLSMTokenDenomTrace(ctx sdk.Context, denom string) (transfertypes.DenomTrace, 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) GetOuterSafetyBounds(ctx sdk.Context, zone types.HostZone) (sdk.Dec, sdk.Dec)
- func (k *Keeper) GetParam(ctx sdk.Context, key []byte) uint64
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetQueuedHostZoneUnbondingRecords(ctx sdk.Context, chainId string) (epochNumbers []uint64, ...)
- func (k Keeper) GetRebalanceICAMessages(hostZone types.HostZone, validatorDeltas []RebalanceValidatorDelegationChange) (msgs []proto.Message, rebalancings []*types.Rebalancing)
- func (k Keeper) GetRedemptionTransferMsg(ctx sdk.Context, userRedemptionRecord *recordstypes.UserRedemptionRecord, ...) (*IcaTx, error)
- func (k Keeper) GetStIbcDenomOnHostZone(ctx sdk.Context, hostZone types.HostZone) (ibcStakedDenom string, err error)
- func (k Keeper) GetStrideEpochElapsedShare(ctx sdk.Context) (sdk.Dec, error)
- func (k Keeper) GetTargetValAmtsForHostZone(ctx sdk.Context, hostZone types.HostZone, totalDelegation sdkmath.Int) (map[string]sdkmath.Int, error)
- func (k Keeper) GetTotalTokenizedDelegations(ctx sdk.Context, hostZone types.HostZone) sdk.Dec
- func (k Keeper) GetTotalUnbondAmount(ctx sdk.Context, ...) (totalUnbonded sdkmath.Int)
- func (k Keeper) GetTotalValidatorWeight(validators []types.Validator) uint64
- func (k Keeper) GetTradeRoute(ctx sdk.Context, rewardDenom string, hostDenom string) (val types.TradeRoute, found bool)
- func (k Keeper) GetUnbondingICAMessages(hostZone types.HostZone, totalUnbondAmount sdkmath.Int, ...) (msgs []proto.Message, unbondings []*types.SplitDelegation, err error)
- func (k Keeper) GetUndelegatedBalance(chainId string, depositRecords []recordstypes.DepositRecord) sdk.Dec
- func (k Keeper) GetUpdatedSlashQueryCheckpoint(ctx sdk.Context, totalDelegations sdkmath.Int) sdkmath.Int
- func (k Keeper) GetValidatorDelegationDifferences(ctx sdk.Context, hostZone types.HostZone) ([]RebalanceValidatorDelegationChange, error)
- func (k Keeper) GetValidatorFromLSMTokenDenom(denom string, validators []*types.Validator) (types.Validator, error)
- func (k Keeper) GetValidatorUnbondCapacity(ctx sdk.Context, validators []*types.Validator, ...) (validatorCapacities []ValidatorUnbondCapacity)
- 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) ICQCallbackHandler() ICQCallbacks
- func (k Keeper) IncrementValidatorDelegationChangesInProgress(hostZone *types.HostZone, validatorAddress string) error
- func (k Keeper) IncrementValidatorSlashQueryProgress(ctx sdk.Context, chainId string, validatorAddress string, amount sdkmath.Int) error
- func (k Keeper) InitiateAllHostZoneUnbondings(ctx sdk.Context, dayNumber uint64)
- 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) IterateHostZones(ctx sdk.Context, ...)
- func (k Keeper) LSMSlashQueryCallback(ctx sdk.Context, hostZone types.HostZone, query icqtypes.Query, ...) error
- func (k Keeper) LSMSlashQueryTimeout(ctx sdk.Context, hostZone types.HostZone, query icqtypes.Query) error
- func (k Keeper) LiquidStakeCommunityPoolTokens(ctx sdk.Context, hostZone types.HostZone) error
- 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) 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) OnChanOpenAck(ctx sdk.Context, portID, channelID string) error
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) PoolPriceQuery(ctx sdk.Context, route types.TradeRoute) error
- func (k Keeper) PostRedemptionRateToOracles(ctx sdk.Context, hostDenom string, redemptionRate sdk.Dec) error
- func (k Keeper) ProcessAllCommunityPoolTokens(ctx sdk.Context)
- func (k Keeper) QueryCommunityPoolIcaBalance(ctx sdk.Context, hostZone types.HostZone, icaType types.ICAAccountType, ...) error
- func (k Keeper) QueryValidatorSharesToTokensRate(ctx sdk.Context, chainId string, validatorAddress string) error
- func (k Keeper) RebalanceAllHostZones(ctx sdk.Context)
- func (k Keeper) RebalanceCallback(ctx sdk.Context, packet channeltypes.Packet, ...) error
- func (k Keeper) RebalanceDelegationsForHostZone(ctx sdk.Context, chainId string) error
- func (k Keeper) RedeemCommunityPoolTokens(ctx sdk.Context, hostZone types.HostZone) error
- func (k Keeper) RedemptionCallback(ctx sdk.Context, packet channeltypes.Packet, ...) error
- func (k Keeper) RefreshHostZoneUnbondingNativeTokenAmount(ctx sdk.Context, epochNumber uint64, ...) error
- func (k Keeper) RefreshUnbondingNativeTokenAmounts(ctx sdk.Context, hostZoneUnbondings map[uint64]recordstypes.HostZoneUnbonding) error
- func (k Keeper) RefreshUserRedemptionRecordNativeAmounts(ctx sdk.Context, chainId string, userRedemptionRecordIds []string, ...) (totalNativeAmount sdkmath.Int)
- func (k Keeper) RegisterStTokenDenomsToWhitelist(ctx sdk.Context, denoms []string) error
- func (k Keeper) RegisterTradeRouteICAAccount(ctx sdk.Context, tradeRouteId string, connectionId string, ...) (account types.ICAAccount, err error)
- func (k Keeper) ReinvestCallback(ctx sdk.Context, packet channeltypes.Packet, ...) error
- func (k Keeper) ReinvestRewards(ctx sdk.Context)
- func (k Keeper) RemoveEpochTracker(ctx sdk.Context, epochIdentifier string)
- func (k Keeper) RemoveHostZone(ctx sdk.Context, chainId string)
- func (k Keeper) RemoveTradeRoute(ctx sdk.Context, rewardDenom string, hostDenom 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) SetTradeRoute(ctx sdk.Context, tradeRoute types.TradeRoute)
- func (k Keeper) SetWithdrawalAddress(ctx sdk.Context)
- func (k Keeper) SetWithdrawalAddressOnHost(ctx sdk.Context, hostZone types.HostZone) error
- func (k Keeper) ShouldCheckIfValidatorWasSlashed(ctx sdk.Context, validator types.Validator, transactionStakeAmount sdkmath.Int) bool
- func (k Keeper) SlashValidatorOnHostZone(ctx sdk.Context, hostZone types.HostZone, valIndex int64, ...) error
- func (k Keeper) StakeExistingDepositsOnHostZones(ctx sdk.Context, epochNumber uint64, ...)
- func (k Keeper) StartLSMLiquidStake(ctx sdk.Context, msg types.MsgLSMLiquidStake) (types.LSMLiquidStake, error)
- func (k Keeper) StoreHostZoneIcaAddress(ctx sdk.Context, chainId, portId, address string) error
- func (k Keeper) StoreTradeRouteIcaAddress(ctx sdk.Context, callbackChainId, callbackPortId, address string) error
- func (k Keeper) SubmitCalibrationICQ(ctx sdk.Context, hostZone types.HostZone, validatorAddress string) error
- func (k Keeper) SubmitDelegationICQ(ctx sdk.Context, hostZone types.HostZone, validatorAddress string) error
- func (k Keeper) SubmitICATxWithoutCallback(ctx sdk.Context, connectionId string, icaAccountOwner string, ...) 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) SubmitValidatorSharesToTokensRateICQ(ctx sdk.Context, chainId string, validatorAddress string, ...) error
- func (k Keeper) SubmitValidatorSlashQuery(ctx sdk.Context, lsmLiquidStake types.LSMLiquidStake) error
- func (k Keeper) SwapAllRewardTokens(ctx sdk.Context)
- func (k Keeper) SwapRewardTokens(ctx sdk.Context, rewardAmount sdkmath.Int, route types.TradeRoute) 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) ToggleLSMProposal(ctx sdk.Context, msg *types.ToggleLSMProposal) error
- func (k Keeper) TradeConvertedBalanceQuery(ctx sdk.Context, route types.TradeRoute) error
- func (k Keeper) TradeRewardBalanceQuery(ctx sdk.Context, route types.TradeRoute) error
- func (k Keeper) TransferAllLSMDeposits(ctx sdk.Context)
- func (k Keeper) TransferAllRewardTokens(ctx sdk.Context)
- func (k Keeper) TransferCommunityPoolDepositToHolding(ctx sdk.Context, hostZone types.HostZone, token sdk.Coin) error
- func (k Keeper) TransferConvertedTokensTradeToHost(ctx sdk.Context, amount sdkmath.Int, route types.TradeRoute) error
- func (k Keeper) TransferExistingDepositsToHostZones(ctx sdk.Context, epochNumber uint64, ...)
- func (k Keeper) TransferHoldingToCommunityPoolReturn(ctx sdk.Context, hostZone types.HostZone, coin sdk.Coin) error
- func (k Keeper) TransferRewardTokensHostToTrade(ctx sdk.Context, amount sdkmath.Int, route types.TradeRoute) error
- func (k Keeper) UnbondFromHostZone(ctx sdk.Context, hostZone types.HostZone) error
- func (k Keeper) UndelegateCallback(ctx sdk.Context, packet channeltypes.Packet, ...) error
- 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) UpdateAllSwapPrices(ctx sdk.Context)
- func (k Keeper) UpdateDelegationBalances(ctx sdk.Context, hostZone 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) UpdateRedemptionRateForHostZone(ctx sdk.Context, hostZone types.HostZone, ...)
- func (k Keeper) UpdateRedemptionRates(ctx sdk.Context, depositRecords []recordstypes.DepositRecord)
- func (k Keeper) UpdateWithdrawalBalance(ctx sdk.Context, hostZone types.HostZone) error
- func (k Keeper) ValidateLSMLiquidStake(ctx sdk.Context, msg types.MsgLSMLiquidStake) (types.LSMLiquidStake, error)
- func (k Keeper) Validators(c context.Context, req *types.QueryGetValidatorsRequest) (*types.QueryGetValidatorsResponse, error)
- func (k Keeper) WithdrawalRewardBalanceQuery(ctx sdk.Context, route types.TradeRoute) error
- type PacketForwardMetadata
- type RebalanceValidatorDelegationChange
- type ValidatorUnbondCapacity
Constants ¶
const ( ICACallbackID_Delegate = "delegate" ICACallbackID_Claim = "claim" ICACallbackID_Undelegate = "undelegate" ICACallbackID_Reinvest = "reinvest" ICACallbackID_Redemption = "redemption" ICACallbackID_Rebalance = "rebalance" ICACallbackID_Detokenize = "detokenize" )
const ( ICQCallbackID_WithdrawalBalance = "withdrawalbalance" ICQCallbackID_FeeBalance = "feebalance" ICQCallbackID_Delegation = "delegation" ICQCallbackID_Validator = "validator" ICQCallbackID_Calibrate = "calibrate" ICQCallbackID_CommunityPoolIcaBalance = "communitypoolicabalance" ICQCallbackID_WithdrawalRewardBalance = "withdrawalrewardbalance" ICQCallbackID_TradeRewardBalance = "traderewardbalance" ICQCallbackID_TradeConvertedBalance = "tradeconvertedbalance" ICQCallbackID_PoolPrice = "poolprice" )
const (
ClaimRewardsICABatchSize = 10
)
const (
MinValidatorsBeforeWeightCapCheck = 10
)
const RebalanceIcaBatchSize = 5
const StrideEpochsPerDayEpoch = uint64(4)
const (
UndelegateICABatchSize = 32
)
Variables ¶
var ( // A valid IBC path for the LSM token must only consist of 1 channel hop along a transfer channel // (e.g. "transfer/channel-0") IsValidIBCPath = regexp.MustCompile(fmt.Sprintf(`^%s/(%s[0-9]{1,20})$`, transfertypes.PortID, channeltypes.ChannelPrefix)).MatchString // Timeout for the validator slash query that occurs at periodic deposit intervals LSMSlashQueryTimeout = time.Minute * 5 // 5 minutes // Time for the detokenization ICA DetokenizationTimeout = time.Hour * 24 // 1 day )
var ( CommunityPoolStakeHoldingAddressKey = "community-pool-stake" CommunityPoolRedeemHoldingAddressKey = "community-pool-redeem" DefaultMaxAllowedSwapLossRate = "0.05" DefaultMaxSwapAmount = sdkmath.NewIntWithDecimal(10, 24) // 10e24 )
var CalibrationThreshold = sdk.NewInt(5000)
CalibrationThreshold is the max amount of tokens by which a calibration can alter internal record keeping of delegations
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the stakeibc module
func AssertTwapAssetsMatchTradeRoute ¶
func AssertTwapAssetsMatchTradeRoute(twapRecord types.OsmosisTwapRecord, tradeRoute types.TradeRoute) error
Helper function to confirm that the two assets in the twap record match the assets in the trade route The assets in the twap record are sorted alphabetically, so we have to check both orderings
func CalibrateDelegationCallback ¶
func CalibrateDelegationCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
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 shares to tokens rate
- the Delegation ICA's delegated shares And apply the following equation: numTokens = numShares * sharesToTokensRate
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 CommunityPoolIcaBalanceCallback ¶
func CommunityPoolIcaBalanceCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
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 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 shares to tokens rate
- the Delegation ICA's delegated shares And apply the following equation: numTokens = numShares * sharesToTokensRate
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 EmitFailedLSMLiquidStakeEvent ¶
func EmitFailedLSMLiquidStakeEvent(ctx sdk.Context, hostZone types.HostZone, lsmTokenDeposit recordstypes.LSMTokenDeposit, errorMessage string)
Emits a failed LSM liquid stake event, and displays the error
func EmitPendingLSMLiquidStakeEvent ¶
func EmitPendingLSMLiquidStakeEvent(ctx sdk.Context, hostZone types.HostZone, lsmTokenDeposit recordstypes.LSMTokenDeposit)
Emits a pending LSM liquid stake event, meaning a slash query was submitted
func EmitSuccessfulLSMLiquidStakeEvent ¶
func EmitSuccessfulLSMLiquidStakeEvent(ctx sdk.Context, hostZone types.HostZone, lsmTokenDeposit recordstypes.LSMTokenDeposit)
Emits a successful LSM liquid stake event, and displays metadata such as the stToken amount
func EmitSuccessfulLiquidStakeEvent ¶
func EmitSuccessfulLiquidStakeEvent(ctx sdk.Context, msg *types.MsgLiquidStake, hostZone types.HostZone, stAmount sdkmath.Int)
Emits a successful liquid stake event, and displays metadata such as the stToken amount
func EmitUndelegationEvent ¶
Emits an event if an undelegation ICA was submitted for a host zone
func EmitValidatorSharesToTokensRateChangeEvent ¶
func EmitValidatorSharesToTokensRateChangeEvent( ctx sdk.Context, chainId string, validatorAddress string, previousSharesToTokensRate, currentSharesToTokensRate sdk.Dec, )
Emits an event if a validator's shares to tokens rate changed
func EmitValidatorSlashEvent ¶
func EmitValidatorSlashEvent( ctx sdk.Context, hostZone types.HostZone, validatorAddress string, slashPercent sdk.Dec, slashAmount sdkmath.Int, currentDelegation sdkmath.Int, )
Emits an event if a validator was slashed
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 GetLSMTokenDepositId ¶
Generates a unique ID for the LSM token deposit so that, if a slash query is issued, the query callback can be joined back with this tx The key in the store for an LSMTokenDeposit is chainId + denom (meaning, there can only be 1 LSMLiquidStake in progress per tokenization)
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 PoolPriceCallback ¶
PoolPriceCallback is a callback handler for PoolPrice query. The query response returns an Osmosis TwapRecord for the associated pool denom's
The assets in the response are identified by indicies and are sorted alphabetically (e.g. if the two denom's are ibc/AXXX, and ibc/BXXX, then Asset0Denom is ibc/AXXX and Asset1Denom is ibc/BXXX)
The price fields (P0LastSpotPrice and P1LastSpotPrice) represent the relative ratios of tokens in the pool
P0LastSpotPrice gives the ratio of Asset0Denom / Asset1Denom P1LastSpotPrice gives the ratio of Asset1Denom / Asset0Denom
When storing down the price, we want to store down the ratio of HostDenom. Meaning, if Asset0Denom is the host denom, we want to store P0LastSpotPrice
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers all governance invariants.
func TradeConvertedBalanceCallback ¶
func TradeConvertedBalanceCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
TradeConvertedBalanceCallback is a callback handler for TradeConvertedBalance queries. The query response will return the trade account balance for a converted (foreign ibc) denom If the balance is non-zero, ICA MsgSends are submitted to transfer the discovered balance back to hostZone
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 TradeRewardBalanceCallback ¶
TradeRewardBalanceCallback is a callback handler for TradeRewardBalance queries. The query response will return the trade ICA account balance for a specific (foreign ibc) denom If the balance is non-zero, ICA MsgSends are submitted to initiate a swap on the tradeZone
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 ValidatorSharesToTokensRateCallback ¶
func ValidatorSharesToTokensRateCallback(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 sharesToTokens rate
- the Delegation ICA's delegated shares And apply the following equation: numTokens = numShares * sharesToTokensRate
This is the callback from query #1 We only issue query #2 if the validator sharesToTokens rate from #1 has changed (indicating a slash)
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"
func WithdrawalRewardBalanceCallback ¶
func WithdrawalRewardBalanceCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error
WithdrawalRewardBalanceCallback is a callback handler for WithdrawalRewardBalance queries. The query response will return the withdrawal account balance for a specific (foreign ibc) denom If the balance is non-zero, ICA MsgSends are submitted to transfer the discovered balance to the tradeZone
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 ForwardMetadata ¶
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 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 AccountKeeper types.AccountKeeper InterchainQueryKeeper icqkeeper.Keeper RecordsKeeper recordsmodulekeeper.Keeper StakingKeeper stakingkeeper.Keeper ICACallbacksKeeper icacallbackskeeper.Keeper RatelimitKeeper types.RatelimitKeeper ICAOracleKeeper types.ICAOracleKeeper ConsumerKeeper types.ConsumerKeeper // contains filtered or unexported fields }
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, ps paramtypes.Subspace, authority string, 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, icaOracleKeeper types.ICAOracleKeeper, ConsumerKeeper types.ConsumerKeeper, ) Keeper
func (Keeper) AddDelegationToValidator ¶
func (k Keeper) AddDelegationToValidator( ctx sdk.Context, hostZone *types.HostZone, validatorAddress string, amount sdkmath.Int, callbackId string, ) error
Updates a validator's individual delegation, and the corresponding total delegation on the host zone Note: This modifies the original host zone struct. The calling function must Set this host zone for changes to persist
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) AllTradeRoutes ¶
func (k Keeper) AllTradeRoutes(c context.Context, req *types.QueryAllTradeRoutes) (*types.QueryAllTradeRoutesResponse, error)
func (Keeper) AllocateHostZoneReward ¶
(1) liquid stake reward collector balance, then (2) sweet stTokens from reward collector to fee collector
func (Keeper) AssertStrideAndDayEpochRelationship ¶
TODO: Consider removing stride and day epochs completely and using a single hourly epoch Confirm the number of stride epochs in 1 day epoch
func (Keeper) BeforeEpochStart ¶
func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochInfo epochstypes.EpochInfo)
func (Keeper) BeginBlocker ¶
BeginBlocker of stakeibc module
func (Keeper) BuildHostToTradeTransferMsg ¶
func (k Keeper) BuildHostToTradeTransferMsg( ctx sdk.Context, amount sdkmath.Int, route types.TradeRoute, ) (msg transfertypes.MsgTransfer, err error)
Builds a PFM transfer message to send reward tokens from the host zone, through the reward zone (to unwind) and finally to the trade zone
func (Keeper) BuildSwapMsg ¶
func (k Keeper) BuildSwapMsg(rewardAmount sdkmath.Int, route types.TradeRoute) (msg types.MsgSwapExactAmountIn, err error)
Builds the Osmosis swap message to trade reward tokens for host tokens Depending on min and max swap amounts set in the route, it is possible not the full amount given will swap The minimum amount of tokens that can come out of the trade is calculated using a price from the pool
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) CalculateLSMStToken ¶
func (k Keeper) CalculateLSMStToken(liquidStakedShares sdkmath.Int, lsmLiquidStake types.LSMLiquidStake) sdk.Coin
Given an LSMToken representing a number of delegator shares, returns the stToken coin using the validator's sharesToTokens rate and the host zone redemption rate
StTokens = LSMTokenShares * Validator SharesToTokens Rate / Redemption Rate
Note: in the event of a slash query, these tokens will be minted only if the validator's sharesToTokens rate did not change
func (Keeper) Callbacks ¶
func (k Keeper) Callbacks() icacallbackstypes.ModuleCallbacks
func (Keeper) CheckDelegationChangedDuringQuery ¶
func (k Keeper) CheckDelegationChangedDuringQuery( ctx sdk.Context, validator types.Validator, previousInternalDelegation sdkmath.Int, currentInternalDelegation sdkmath.Int, ) (overlapped bool, err error)
The number of tokens returned from the query must be consistent with the tokens stored in our internal record keeping during this callback, otherwise the comparision between the two is invalidated
As a result, we must avoid a race condition between the ICQ and a delegate, undelegate, redelegate, or detokenization ICA
More specifically, we must avoid the following cases:
Case 1) ICQ Lands on Host ICQ Ack on Stride ICA Lands on Host ICA Ack on Stride Case 2) ICA Lands on Host ICA Ack on Stride ICQ Lands on Host ICQ Ack on Stride
We can prevent Case #1 by checking if the delegation total on the validator has changed while the query was in flight
We can prevent Case #2 by checking if the validator has a delegation change in progress
func (Keeper) CheckForSlash ¶
func (k Keeper) CheckForSlash( ctx sdk.Context, hostZone types.HostZone, valIndex int64, queriedDelegation stakingtypes.Delegation, ) (validatorWasSlashed bool, delegatedTokens sdkmath.Int, err error)
Check if a slash occured by comparing the validator's sharesToTokens rate and delegator shares from the query responses (tokens = shares * sharesToTokensRate)
If the change in delegation only differs by a small precision error, it was likely due to an decimal -> int truncation that occurs during unbonding. In this case, still update the validator
If the change in delegation was an increase, the response can't be trusted so an error is thrown
func (Keeper) CheckIfValidatorWasSlashed ¶
func (k Keeper) CheckIfValidatorWasSlashed( ctx sdk.Context, hostZone types.HostZone, queriedValidator stakingtypes.Validator, ) (validatorWasSlashed bool, err error)
Determines if the validator was slashed by comparing the validator sharesToTokens rate from the query response with the sharesToTokens rate stored on the validator
func (Keeper) CheckIsStToken ¶
Validate whether a denom is a supported liquid staking token
func (Keeper) CheckValidatorWeightsBelowCap ¶
Checks if any validator's portion of the weight is greater than the cap
func (Keeper) ClaimAccruedStakingRewards ¶
Claim staking rewards for each host zone
func (Keeper) ClaimAccruedStakingRewardsOnHost ¶
func (Keeper) ClaimCallback ¶
func (k Keeper) ClaimCallback(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 (Keeper) CleanupEpochUnbondingRecords ¶
Deletes any epoch unbonding records that have had all unbondings claimed
func (Keeper) ConsolidateUnbondingMessages ¶
func (k Keeper) ConsolidateUnbondingMessages( totalUnbondAmount sdkmath.Int, initialUnbondings []*types.SplitDelegation, unbondCapacities []ValidatorUnbondCapacity, batchSize int, ) (finalUnbondings []*types.SplitDelegation, err error)
In the event that the number of generated undelegate messages exceeds the batch size, reduce the number of messages by dividing any excess amongst proportionally based on the remaining delegation This will no longer be necessary after undelegations to 32+ validators is supported NOTE: This assumes unbondCapacities are stored in order of capacity
func (Keeper) CreateDepositRecordsForEpoch ¶
Create a new deposit record for each host zone for the given epoch
func (Keeper) CreateEpochUnbondingRecord ¶
Creates a new epoch unbonding record for the epoch
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) DecrementValidatorDelegationChangesInProgress ¶
func (k Keeper) DecrementValidatorDelegationChangesInProgress(hostZone *types.HostZone, validatorAddress string) error
Decrements the number of validator delegation changes in progress by 1 Note: This modifies the original host zone struct. The calling function must Set this host zone for changes to persist
func (Keeper) DelegateCallback ¶
func (k Keeper) DelegateCallback(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 (Keeper) DelegateOnHost ¶
func (k Keeper) DelegateOnHost(ctx sdk.Context, hostZone types.HostZone, amt sdk.Coin, depositRecord recordstypes.DepositRecord) error
func (Keeper) DetokenizeAllLSMDeposits ¶
Loops through all active host zones, grabs the queued LSMTokenDeposits for that host that are in status DETOKENIZATION_QUEUE, and submits the detokenization ICA for each
func (Keeper) DetokenizeCallback ¶
func (k Keeper) DetokenizeCallback(ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
ICACallback after an LSM token is detokenized into native stake
If successful: Remove the token deposit from the store and incremenet the validator delegation If failure: flag the deposit as DETOKENIZATION_FAILED If timeout: do nothing - A timeout will force the channel closed, and once the channel is restored, the ICA will get resubmitted
func (Keeper) DetokenizeLSMDeposit ¶
func (k Keeper) DetokenizeLSMDeposit(ctx sdk.Context, hostZone types.HostZone, deposit recordstypes.LSMTokenDeposit) error
Submits an ICA to "Redeem" an LSM Token - meaning converting the token into native stake This function is called in the EndBlocker which means if the ICA submission fails, any modified state is not reverted
The deposit Status is intentionally updated before the ICA is submitted even though it will NOT be reverted if the ICA fails to send. This is because a failure is likely caused by a closed ICA channel, and the status update will prevent the ICA from being continuously re-submitted. When the ICA channel is restored, the deposit status will get reset, and the ICA will be attempted again.
func (Keeper) DisableHubTokenization ¶
TODO [cleanup]: Remove after v17 upgrade
func (Keeper) EndBlocker ¶
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) FailLSMLiquidStake ¶
func (k Keeper) FailLSMLiquidStake(ctx sdk.Context, hostZone types.HostZone, lsmLiquidStake types.LSMLiquidStake, errorMessage string)
Fail an LSMLiquidStake transaction by emitting an event and removing the LSMTokenDeposit record
func (Keeper) FinishLSMLiquidStake ¶
func (k Keeper) FinishLSMLiquidStake(ctx sdk.Context, lsmLiquidStake types.LSMLiquidStake, async bool) error
FinishLSMLiquidStake finishes the liquid staking flow by escrowing the LSM token, sending a user their stToken, and then IBC transfering the LSM Token to the host zone
If the slash query interrupted the transaction, this function is called asynchronously after the query callback
If no slash query was needed, this is called synchronously after StartLSMLiquidStake If this is run asynchronously, we need to re-validate the transaction info (e.g. staker's balance)
func (Keeper) FundCommunityPool ¶
Using tokens in the CommunityPoolReturnIcaAddress, trigger ICA tx to fund community pool Note: The denom of the passed in token has to be the denom which exists on the hostZone not Stride
func (Keeper) GetActiveHostZone ¶
func (k Keeper) GetActiveHostZone(ctx sdk.Context, chainId string) (hostZone types.HostZone, err error)
GetActiveHostZone returns an error if the host zone is not found or if it's found, but is halted
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) GetAllTradeRoutes ¶
func (k Keeper) GetAllTradeRoutes(ctx sdk.Context) (list []types.TradeRoute)
GetAllTradeRoute returns all tradeRoutes
func (Keeper) GetAuthority ¶
GetAuthority returns the x/stakeibc module's authority.
func (Keeper) GetChainIdFromConnectionId ¶
Lookup a chain ID from a connection ID by looking up the client state
func (Keeper) GetClaimableRedemptionRecord ¶
func (k Keeper) GetClaimableRedemptionRecord(ctx sdk.Context, msg *types.MsgClaimUndelegatedTokens) (*recordstypes.UserRedemptionRecord, error)
func (Keeper) GetConnectionIdFromICAPortId ¶
func (k Keeper) GetConnectionIdFromICAPortId(ctx sdk.Context, portId string) (connectionId string, found bool)
Searches all interchain accounts and finds the connection ID that corresponds with a given port ID
func (Keeper) GetDepositAccountBalance ¶
func (k Keeper) GetDepositAccountBalance(chainId string, depositRecords []recordstypes.DepositRecord) sdk.Dec
Determine the deposit account balance, representing native tokens that have been deposited from liquid stakes, but have not yet been transferred to the host
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) GetHostZoneFromLSMTokenPath ¶
Parses the LSM token's IBC path (e.g. transfer/channel-0) and confirms the channel ID matches the transfer channel of a supported host zone
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) GetICATimeoutNanos ¶
func (Keeper) GetInnerSafetyBounds ¶
func (Keeper) GetLSMTokenDenomTrace ¶
func (k Keeper) GetLSMTokenDenomTrace(ctx sdk.Context, denom string) (transfertypes.DenomTrace, error)
Parse the LSM Token's IBC denom hash into a DenomTrace object that contains the path and base denom
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 ¶
TODO [cleanup]: Cleanup error messages, and rename to GetLightClientHeight Retrieves the light client time for a given connection
func (Keeper) GetLightClientTimeSafely ¶
TODO [cleanup]: Cleanup error messages, and rename to GetLightClientTime Retrieves the light client time for a given connection
func (Keeper) GetOuterSafetyBounds ¶
func (Keeper) GetQueuedHostZoneUnbondingRecords ¶
func (k Keeper) GetQueuedHostZoneUnbondingRecords( ctx sdk.Context, chainId string, ) (epochNumbers []uint64, epochToHostZoneUnbondingMap map[uint64]recordstypes.HostZoneUnbonding)
Returns all the host zone unbonding records that should unbond this epoch Records are returned as a mapping of epoch unbonding record ID to host zone unbonding record Records ready to be unbonded are identified by status UNBONDING_QUEUE and a non-zero native amount
func (Keeper) GetRebalanceICAMessages ¶
func (k Keeper) GetRebalanceICAMessages( hostZone types.HostZone, validatorDeltas []RebalanceValidatorDelegationChange, ) (msgs []proto.Message, rebalancings []*types.Rebalancing)
Given a list of target delegation changes, builds the individual re-delegation messages by redelegating from surplus validators to deficit validators Returns the list of messages and the callback data for the ICA
func (Keeper) GetRedemptionTransferMsg ¶
func (k Keeper) GetRedemptionTransferMsg(ctx sdk.Context, userRedemptionRecord *recordstypes.UserRedemptionRecord, hostZoneId string) (*IcaTx, error)
func (Keeper) GetStIbcDenomOnHostZone ¶
func (k Keeper) GetStIbcDenomOnHostZone(ctx sdk.Context, hostZone types.HostZone) (ibcStakedDenom string, err error)
given a hostZone with native denom, returns the ibc denom on the zone for the staked stDenom
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, totalDelegation sdkmath.Int) (map[string]sdkmath.Int, error)
This will split a total delegation amount across validators, according to weights It returns a map of each portion, key'd on validator address Validator's with a slash query in progress are excluded
func (Keeper) GetTotalTokenizedDelegations ¶
Returns the total delegated balance that's stored in LSM tokens This is used for the redemption rate calculation
The relevant tokens are identified by the deposit records in status "DEPOSIT_PENDING" "DEPOSIT_PENDING" means the liquid staker's tokens have not been sent to Stride yet so they should *not* be included in the redemption rate. All other statuses indicate the LSM tokens have been deposited and should be included in the final calculation
Each LSM token represents a delegator share so the validator's shares to tokens rate must be used to denominate it's value in native tokens
func (Keeper) GetTotalUnbondAmount ¶
func (k Keeper) GetTotalUnbondAmount(ctx sdk.Context, hostZoneUnbondingRecords map[uint64]recordstypes.HostZoneUnbonding) (totalUnbonded sdkmath.Int)
Gets the total unbonded amount for a host zone by looping through the epoch unbonding records Also returns the epoch unbonding record ids
func (Keeper) GetTotalValidatorWeight ¶
Sum the total weights across each validator for a host zone
func (Keeper) GetTradeRoute ¶
func (k Keeper) GetTradeRoute(ctx sdk.Context, rewardDenom string, hostDenom string) (val types.TradeRoute, found bool)
GetTradeRoute returns a tradeRoute from its start and end denoms The start and end denom's are in their native format (e.g. uusdc and udydx)
func (Keeper) GetUnbondingICAMessages ¶
func (k Keeper) GetUnbondingICAMessages( hostZone types.HostZone, totalUnbondAmount sdkmath.Int, prioritizedUnbondCapacity []ValidatorUnbondCapacity, batchSize int, ) (msgs []proto.Message, unbondings []*types.SplitDelegation, err error)
Given a total unbond amount and list of unbond capacity for each validator, sorted by unbond priority Iterates through the list and unbonds as much as possible from each validator until all the unbonding has been accounted for
Returns the list of messages and the callback data for the ICA
func (Keeper) GetUndelegatedBalance ¶
func (k Keeper) GetUndelegatedBalance(chainId string, depositRecords []recordstypes.DepositRecord) sdk.Dec
Determine the undelegated balance from the deposit records queued for staking
func (Keeper) GetUpdatedSlashQueryCheckpoint ¶
func (k Keeper) GetUpdatedSlashQueryCheckpoint(ctx sdk.Context, totalDelegations sdkmath.Int) sdkmath.Int
Determines the new slash query checkpoint, by mulitplying the query threshold percent by the current TVL
func (Keeper) GetValidatorDelegationDifferences ¶
func (k Keeper) GetValidatorDelegationDifferences(ctx sdk.Context, hostZone types.HostZone) ([]RebalanceValidatorDelegationChange, error)
This function returns a list with the number of extra tokens that should be sent to each validator
- Positive delta implies the validator has a surplus (and should lose stake)
- Negative delta implies the validator has a deficit (and should gain stake)
func (Keeper) GetValidatorFromLSMTokenDenom ¶
func (k Keeper) GetValidatorFromLSMTokenDenom(denom string, validators []*types.Validator) (types.Validator, error)
Parses the LSM token's denom (of the form {validatorAddress}/{recordId}) and confirms that the validator is in the Stride validator set and does not have an active slash query
func (Keeper) GetValidatorUnbondCapacity ¶
func (k Keeper) GetValidatorUnbondCapacity( ctx sdk.Context, validators []*types.Validator, balancedDelegation map[string]sdkmath.Int, ) (validatorCapacities []ValidatorUnbondCapacity)
Determine the unbonding capacity that each validator has The capacity is determined by the difference between their current delegation and their fair portion of the total stake based on their weights (i.e. their balanced delegation)
Validators with a balanced delegation less than their current delegation are already at a deficit, are not included in the returned list, and thus, will not incur any unbonding
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) ICQCallbackHandler ¶
func (k Keeper) ICQCallbackHandler() ICQCallbacks
func (Keeper) IncrementValidatorDelegationChangesInProgress ¶
func (k Keeper) IncrementValidatorDelegationChangesInProgress(hostZone *types.HostZone, validatorAddress string) error
Increments the number of validator delegation changes in progress by 1 Note: This modifies the original host zone struct. The calling function must Set this host zone for changes to persist
func (Keeper) IncrementValidatorSlashQueryProgress ¶
func (k Keeper) IncrementValidatorSlashQueryProgress( ctx sdk.Context, chainId string, validatorAddress string, amount sdkmath.Int, ) error
Increments the validators slash query progress tracker
func (Keeper) InitiateAllHostZoneUnbondings ¶
this function iterates each host zone, and if it's the right time to initiate an unbonding, it attempts to unbond all outstanding records
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) IterateHostZones ¶
func (k Keeper) IterateHostZones(ctx sdk.Context, fn func(ctx sdk.Context, index int64, zoneInfo types.HostZone) error)
IterateHostZones iterates zones TODO [cleanup]: Remove this in favor of GetAllHostZones
func (Keeper) LSMSlashQueryCallback ¶
func (k Keeper) LSMSlashQueryCallback( ctx sdk.Context, hostZone types.HostZone, query icqtypes.Query, validatorWasSlashed bool, ) error
Callback handler for if the slash query was initiated by an LSMLiquidStake transaction If the validator was slashed, the LSMLiquidStake should be rejected If the validator was not slashed, the LSMLiquidStake should finish to mint the user stTokens
func (Keeper) LSMSlashQueryTimeout ¶
func (k Keeper) LSMSlashQueryTimeout(ctx sdk.Context, hostZone types.HostZone, query icqtypes.Query) error
Fails the LSM Liquid Stake if the query timed out
func (Keeper) LiquidStakeCommunityPoolTokens ¶
Liquid stake all native tokens in the stake holding address
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) 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) OnChanOpenAck ¶
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) PoolPriceQuery ¶
Kick off ICQ for the spot price on the pool given the input and output denoms implied by the given TradeRoute the callback for this query is responsible for updating the returned spot price on the keeper data
func (Keeper) PostRedemptionRateToOracles ¶
func (k Keeper) PostRedemptionRateToOracles(ctx sdk.Context, hostDenom string, redemptionRate sdk.Dec) error
Pushes a redemption rate update to the ICA oracle
func (Keeper) ProcessAllCommunityPoolTokens ¶
For each hostZone with a valid community pool, trigger the ICQs and ICAs to transfer tokens from DepositICA or back to ReturnICA Since ICQs and ICAs take time to complete, it is almost certain tokens swept in and processed will be swept out in a later epoch
func (Keeper) QueryCommunityPoolIcaBalance ¶
func (k Keeper) QueryCommunityPoolIcaBalance( ctx sdk.Context, hostZone types.HostZone, icaType types.ICAAccountType, denom string, ) error
ICQ specific denom for balance in the deposit ICA or return ICA on the community pool host zone Depending on account type and denom, discovered tokens are transferred to Stride or funded to the pool
func (Keeper) QueryValidatorSharesToTokensRate ¶
func (k Keeper) QueryValidatorSharesToTokensRate(ctx sdk.Context, chainId string, validatorAddress string) error
Submit a validator sharesToTokens rate ICQ as triggered either manually or epochly with a conservative timeout
func (Keeper) RebalanceAllHostZones ¶
Iterate each active host zone and issues redelegation messages to rebalance each validator's stake according to their weights
This is required when accepting LSM LiquidStakes as the distribution of stake from the LSM Tokens will be inconsistend with the host zone's validator set
Note: this cannot be run more than once in a single unbonding period
func (Keeper) RebalanceCallback ¶
func (k Keeper) RebalanceCallback(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 (Keeper) RebalanceDelegationsForHostZone ¶
Rebalance validators according to their validator weights for a specific host zone
func (Keeper) RedeemCommunityPoolTokens ¶
Redeem all the stTokens in the redeem holding address
func (Keeper) RedemptionCallback ¶
func (k Keeper) RedemptionCallback(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 (Keeper) RefreshHostZoneUnbondingNativeTokenAmount ¶
func (k Keeper) RefreshHostZoneUnbondingNativeTokenAmount( ctx sdk.Context, epochNumber uint64, hostZoneUnbondingRecord recordstypes.HostZoneUnbonding, ) error
Sets the native token amount unbonded on the host zone unbonding record and the associated user redemption records
func (Keeper) RefreshUnbondingNativeTokenAmounts ¶
func (k Keeper) RefreshUnbondingNativeTokenAmounts(ctx sdk.Context, hostZoneUnbondings map[uint64]recordstypes.HostZoneUnbonding) error
Given a mapping of epoch unbonding record IDs to host zone unbonding records, sets the native token amount across all epoch unbonding records, host zone unbonding records, and user redemption records, using the most updated redemption rate
func (Keeper) RefreshUserRedemptionRecordNativeAmounts ¶
func (k Keeper) RefreshUserRedemptionRecordNativeAmounts( ctx sdk.Context, chainId string, userRedemptionRecordIds []string, redemptionRate sdk.Dec, ) (totalNativeAmount sdkmath.Int)
Given a list of user redemption record IDs and a redemption rate, sets the native token amount on each record, calculated from the stAmount and redemption rate, and returns the sum of all native token amounts across all user redemption records
func (Keeper) RegisterStTokenDenomsToWhitelist ¶
Register new stTokens to the consumer reward denom whitelist
func (Keeper) RegisterTradeRouteICAAccount ¶
func (k Keeper) RegisterTradeRouteICAAccount( ctx sdk.Context, tradeRouteId string, connectionId string, icaAccountType types.ICAAccountType, ) (account types.ICAAccount, err error)
Registers a new TradeRoute ICAAccount, given the type Stores down the connection and chainId now, and the address upon callback
func (Keeper) ReinvestCallback ¶
func (k Keeper) ReinvestCallback(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 (Keeper) ReinvestRewards ¶
Delegates accrued staking rewards for reinvestment
func (Keeper) RemoveEpochTracker ¶
RemoveEpochTracker removes a epochTracker from the store
func (Keeper) RemoveHostZone ¶
RemoveHostZone removes a hostZone from the store
func (Keeper) RemoveTradeRoute ¶
RemoveTradeRoute removes a tradeRoute from the store The start and end denom's are in their native format (e.g. uusdc and udydx)
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 There must also be no LSMTokenDeposits in progress since this would update the delegation on completion
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) SetTradeRoute ¶
func (k Keeper) SetTradeRoute(ctx sdk.Context, tradeRoute types.TradeRoute)
SetTradeRoute set a specific tradeRoute in the store
func (Keeper) SetWithdrawalAddress ¶
Set the withdrawal account address for each host zone
func (Keeper) SetWithdrawalAddressOnHost ¶
func (Keeper) ShouldCheckIfValidatorWasSlashed ¶
func (k Keeper) ShouldCheckIfValidatorWasSlashed( ctx sdk.Context, validator types.Validator, transactionStakeAmount sdkmath.Int, ) bool
Checks if we need to issue an ICQ to check if a validator was slashed The query runs at periodic intervals defined by the ValidatorSlashQueryInterval The interval is represented as percent of TVL (e.g. 1% means every LS that causes the progress to breach 1% of TVL triggers the query)
func (Keeper) SlashValidatorOnHostZone ¶
func (k Keeper) SlashValidatorOnHostZone(ctx sdk.Context, hostZone types.HostZone, valIndex int64, delegatedTokens sdkmath.Int) error
Update the accounting on the host zone and validator to record the slash NOTE: we assume any decrease in delegation amt that's not tracked via records is a slash
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) StartLSMLiquidStake ¶
func (k Keeper) StartLSMLiquidStake(ctx sdk.Context, msg types.MsgLSMLiquidStake) (types.LSMLiquidStake, error)
StartLSMLiquidStake runs the transactional logic that occurs before the optional query This includes validation on the LSM Token and the stToken amount calculation
func (Keeper) StoreHostZoneIcaAddress ¶
Checks if the chainId matches a given host zone, and the address matches a relevant ICA account If so, stores the ICA address on the host zone struct Also whitelists ICA addresses from rate limiting
func (Keeper) StoreTradeRouteIcaAddress ¶
func (k Keeper) StoreTradeRouteIcaAddress(ctx sdk.Context, callbackChainId, callbackPortId, address string) error
Checks if the port matches an ICA account on the trade route, and if so, stores the relevant ICA address on the trade route
func (Keeper) SubmitCalibrationICQ ¶
func (k Keeper) SubmitCalibrationICQ(ctx sdk.Context, hostZone types.HostZone, validatorAddress string) error
Submits an ICQ to get a validator's delegations This is called after the validator's sharesToTokens rate is determined The timeoutDuration parameter represents the length of the timeout (not to be confused with an actual timestamp)
func (Keeper) SubmitDelegationICQ ¶
func (k Keeper) SubmitDelegationICQ(ctx sdk.Context, hostZone types.HostZone, validatorAddress string) error
Submits an ICQ to get a validator's delegations This is called after the validator's sharesToTokens rate is determined The timeoutDuration parameter represents the length of the timeout (not to be confused with an actual timestamp)
func (Keeper) SubmitICATxWithoutCallback ¶
func (Keeper) SubmitTxs ¶
func (k Keeper) SubmitTxs( ctx sdk.Context, connectionId string, msgs []proto.Message, icaAccountType types.ICAAccountType, timeoutTimestamp uint64, callbackId string, callbackArgs []byte, ) (uint64, error)
SubmitTxs submits an ICA transaction containing multiple messages This function only supports messages to ICAs on the host zone
func (Keeper) SubmitTxsDayEpoch ¶
func (Keeper) SubmitTxsEpoch ¶
func (Keeper) SubmitTxsStrideEpoch ¶
func (Keeper) SubmitValidatorSharesToTokensRateICQ ¶
func (k Keeper) SubmitValidatorSharesToTokensRateICQ( ctx sdk.Context, chainId string, validatorAddress string, callbackDataBz []byte, timeoutDuration time.Duration, timeoutPolicy icqtypes.TimeoutPolicy, ) error
Submits an ICQ to get a validator's shares to tokens rate
func (Keeper) SubmitValidatorSlashQuery ¶
func (k Keeper) SubmitValidatorSlashQuery(ctx sdk.Context, lsmLiquidStake types.LSMLiquidStake) error
SubmitValidatorSlashQuery submits an interchain query for the validator's sharesToTokens rate This is done periodically at checkpoints denominated in native tokens (e.g. every 100k ATOM that's LSM liquid staked with validator X)
func (Keeper) SwapAllRewardTokens ¶
Helper function to be run hourly, kicks off query which will kick off actual swaps to happen
func (Keeper) SwapRewardTokens ¶
func (k Keeper) SwapRewardTokens(ctx sdk.Context, rewardAmount sdkmath.Int, route types.TradeRoute) error
Trade reward tokens in the Trade ICA for the host denom tokens using ICA remote tx on trade zone The amount represents the total amount of the reward token in the trade ICA found by the calling ICQ
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) ToggleLSMProposal ¶
func (Keeper) TradeConvertedBalanceQuery ¶
Kick off ICQ for how many converted tokens are in the trade ICA associated with this host zone
func (Keeper) TradeRewardBalanceQuery ¶
Kick off ICQ for how many reward tokens are in the trade ICA associated with this host zone
func (Keeper) TransferAllLSMDeposits ¶
Loops through all active host zones, grabs queued LSMTokenDeposits for that host that are in status TRANSFER_QUEUE, and submits the IBC Transfer to the host
func (Keeper) TransferAllRewardTokens ¶
Helper function to be run stride epochly, kicks off queries on specific denoms on route
func (Keeper) TransferCommunityPoolDepositToHolding ¶
func (k Keeper) TransferCommunityPoolDepositToHolding(ctx sdk.Context, hostZone types.HostZone, token sdk.Coin) error
Transfers tokens from the community pool deposit ICA account to the host zone stake holding module address for that pool
func (Keeper) TransferConvertedTokensTradeToHost ¶
func (k Keeper) TransferConvertedTokensTradeToHost(ctx sdk.Context, amount sdkmath.Int, route types.TradeRoute) error
ICA tx to kick off transfering the converted tokens back from tradeZone to the hostZone withdrawal ICA
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) TransferHoldingToCommunityPoolReturn ¶
func (k Keeper) TransferHoldingToCommunityPoolReturn(ctx sdk.Context, hostZone types.HostZone, coin sdk.Coin) error
Transfers a recently minted stToken from the stride-side stake holding address to the return ICA address on the host zone
func (Keeper) TransferRewardTokensHostToTrade ¶
func (k Keeper) TransferRewardTokensHostToTrade(ctx sdk.Context, amount sdkmath.Int, route types.TradeRoute) error
ICA tx will kick off transfering the reward tokens from the hostZone withdrawl ICA to the tradeZone trade ICA This will be two hops to unwind the ibc denom through the rewardZone using pfm in the transfer memo
func (Keeper) UnbondFromHostZone ¶
Submits undelegation ICA messages for a given host zone
First, the total unbond amount is determined from the epoch unbonding records Then that unbond amount is allowed to cascade across the validators in order of how proportionally different their current delegations are from the weight implied target delegation, until their capacities have consumed the full amount As a result, unbondings lead to a more balanced distribution of stake across validators
Context: Over time, as LSM Liquid stakes are accepted, the total stake managed by the protocol becomes unbalanced as liquid stakes are not aligned with the validator weights. This is only rebalanced once per unbonding period
func (Keeper) UndelegateCallback ¶
func (k Keeper) UndelegateCallback(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 (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) UpdateAllSwapPrices ¶
Helper function to be run hourly, kicks off query to get and update the swap price in keeper data
func (Keeper) UpdateDelegationBalances ¶
func (k Keeper) UpdateDelegationBalances(ctx sdk.Context, hostZone types.HostZone, undelegateCallback types.UndelegateCallback) error
Decrement the delegation 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) UpdateRedemptionRateForHostZone ¶
func (k Keeper) UpdateRedemptionRateForHostZone(ctx sdk.Context, hostZone types.HostZone, depositRecords []recordstypes.DepositRecord)
func (Keeper) UpdateRedemptionRates ¶
func (k Keeper) UpdateRedemptionRates(ctx sdk.Context, depositRecords []recordstypes.DepositRecord)
Updates the redemption rate for each host zone At a high level, the redemption rate is equal to the amount of native tokens locked divided by the stTokens in existence. The equation is broken down further into the following sub-components:
Native Tokens Locked: 1. Deposit Account Balance: native tokens deposited from liquid stakes, that are still living on Stride 2. Undelegated Balance: native tokens that have been transferred to the host zone, but have not been delegated yet 3. Tokenized Delegations: Delegations inherent in LSM Tokens that have not yet been converted to native stake 4. Native Delegations: Delegations either from native tokens, or LSM Tokens that have been detokenized StToken Amount: 1. Total Supply of the stToken Redemption Rate = (Deposit Account Balance + Undelegated Balance + Tokenized Delegation + Native Delegation) / (stToken Supply)
func (Keeper) UpdateWithdrawalBalance ¶
TODO [cleanup]: Rename to SubmitWithdrawalBalanceICQ Submits an ICQ for the withdrawal account balance
func (Keeper) ValidateLSMLiquidStake ¶
func (k Keeper) ValidateLSMLiquidStake(ctx sdk.Context, msg types.MsgLSMLiquidStake) (types.LSMLiquidStake, error)
Validates the parameters supplied with this LSMLiquidStake, including that the denom corresponds with a valid LSM Token and that the user has sufficient balance
This is called once at the beginning of the liquid stake, and is, potentially, called again at the end (if the transaction was asynchronous due to an intermediate slash query)
This function returns the associated host zone and validator along with the initial deposit record
func (Keeper) Validators ¶
func (k Keeper) Validators(c context.Context, req *types.QueryGetValidatorsRequest) (*types.QueryGetValidatorsResponse, error)
func (Keeper) WithdrawalRewardBalanceQuery ¶
Kick off ICQ for the reward denom balance in the withdrawal address
type PacketForwardMetadata ¶
type PacketForwardMetadata struct {
Forward *ForwardMetadata `json:"forward"`
}
JSON Memo for PFM transfers
type ValidatorUnbondCapacity ¶
type ValidatorUnbondCapacity struct { ValidatorAddress string CurrentDelegation sdkmath.Int BalancedDelegation sdkmath.Int Capacity sdkmath.Int }
func SortUnbondingCapacityByPriority ¶
func SortUnbondingCapacityByPriority(validatorUnbondCapacity []ValidatorUnbondCapacity) ([]ValidatorUnbondCapacity, error)
Sort validators by the ratio of the ideal balanced delegation to their current delegation This will sort the validator's by how proportionally unbalanced they are
Ex:
Val1: Ideal Balanced Delegation 80, Current Delegation 100 (surplus of 20), Ratio: 0.8 Val2: Ideal Balanced Delegation 480, Current Delegation 500 (surplus of 20), Ratio: 0.96
While both validators have the same net unbalanced delegation, Val2 is proportionally more balanced since the surplus is a smaller percentage of it's overall delegation
This will also sort such that 0-weight validator's will come first as their ideal balanced delegation will always be 0, and thus their ratio will always be 0 If the ratio's are equal, the validator with the larger delegation/capacity will come first
func (*ValidatorUnbondCapacity) GetBalanceRatio ¶
func (c *ValidatorUnbondCapacity) GetBalanceRatio() (sdk.Dec, error)
The ratio of ideal balanced delegation to the current delegation This represents how proportionally unbalanced each validator is The smaller number means their current delegation is much larger then their fair portion of the current total stake
Source Files ¶
- abci.go
- claim.go
- community_pool.go
- consumer.go
- delegation.go
- epoch_tracker.go
- events.go
- gov.go
- grpc_query.go
- hooks.go
- host_zone.go
- ibc.go
- icacallbacks.go
- icacallbacks_claim.go
- icacallbacks_delegate.go
- icacallbacks_detokenize.go
- icacallbacks_rebalance.go
- icacallbacks_redemption.go
- icacallbacks_reinvest.go
- icacallbacks_undelegate.go
- icqcallbacks.go
- icqcallbacks_callibrate_delegation.go
- icqcallbacks_community_pool_ica_balance.go
- icqcallbacks_delegator_shares.go
- icqcallbacks_fee_balance.go
- icqcallbacks_pool_price.go
- icqcallbacks_trade_converted_balance.go
- icqcallbacks_trade_reward_balance.go
- icqcallbacks_validator_exchange_rate.go
- icqcallbacks_withdrawal_balance.go
- icqcallbacks_withdrawal_reward_balance.go
- interchainaccounts.go
- interchainqueries.go
- invariants.go
- keeper.go
- lsm.go
- msg_server.go
- params.go
- rebalance.go
- records.go
- redemption_rate.go
- redemption_sweep.go
- reward_allocation.go
- reward_converter.go
- trade_route.go
- transfer.go
- unbonding.go
- validator.go