Documentation ¶
Index ¶
- func EmitHaltZoneEvent(ctx sdk.Context, hostZone types.HostZone)
- func EmitSuccessfulConfirmDelegationEvent(ctx sdk.Context, recordId uint64, delegationAmount sdkmath.Int, txHash string, ...)
- func EmitSuccessfulConfirmUnbondedTokenSweepEvent(ctx sdk.Context, recordId uint64, nativeAmount sdkmath.Int, txHash string, ...)
- func EmitSuccessfulConfirmUndelegationEvent(ctx sdk.Context, recordId uint64, nativeAmount sdkmath.Int, txHash string, ...)
- func EmitSuccessfulLiquidStakeEvent(ctx sdk.Context, staker string, hostZone types.HostZone, ...)
- func EmitSuccessfulRedeemStakeEvent(ctx sdk.Context, staker string, hostZone types.HostZone, ...)
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Hooks
- type Keeper
- func (k Keeper) ArchiveDelegationRecord(ctx sdk.Context, delegationRecord types.DelegationRecord)
- func (k Keeper) ArchiveFailedTransferRecord(ctx sdk.Context, recordId uint64) error
- func (k Keeper) ArchiveUnbondingRecord(ctx sdk.Context, unbondingRecord types.UnbondingRecord)
- func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochInfo epochstypes.EpochInfo)
- func (k Keeper) BeginBlocker(ctx sdk.Context)
- func (k Keeper) BurnRedeemedStTokens(ctx sdk.Context, stTokensToBurn sdk.Coins, redemptionAddress string) error
- func (k Keeper) CheckIsOperatorAddress(ctx sdk.Context, address string) error
- func (k Keeper) CheckIsSafeAddress(ctx sdk.Context, address string) error
- func (k Keeper) CheckIsSafeOrOperatorAddress(ctx sdk.Context, address string) error
- func (k Keeper) CheckRedemptionRateExceedsBounds(ctx sdk.Context) error
- func (k Keeper) ConfirmDelegation(ctx sdk.Context, recordId uint64, txHash string, sender string) (err error)
- func (k Keeper) ConfirmUnbondedTokenSweep(ctx sdk.Context, recordId uint64, txHash string, sender string) (err error)
- func (k Keeper) ConfirmUndelegation(ctx sdk.Context, recordId uint64, txHash string, sender string) (err error)
- func (k Keeper) DelegationRecords(c context.Context, req *types.QueryDelegationRecordsRequest) (*types.QueryDelegationRecordsResponse, error)
- func (k Keeper) DistributeClaims(ctx sdk.Context) error
- func (k Keeper) DistributeClaimsForUnbondingRecord(ctx sdk.Context, hostNativeIbcDenom string, claimAddress sdk.AccAddress, ...) error
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAccumulatingUnbondingRecord(ctx sdk.Context) (unbondingRecord types.UnbondingRecord, err error)
- func (k Keeper) GetAllActiveDelegationRecords(ctx sdk.Context) (delegationRecords []types.DelegationRecord)
- func (k Keeper) GetAllActiveUnbondingRecords(ctx sdk.Context) (unbondingRecords []types.UnbondingRecord)
- func (k Keeper) GetAllArchivedDelegationRecords(ctx sdk.Context) (delegationRecords []types.DelegationRecord)
- func (k Keeper) GetAllArchivedUnbondingRecords(ctx sdk.Context) (unbondingRecords []types.UnbondingRecord)
- func (k Keeper) GetAllRedemptionRecords(ctx sdk.Context) (redemptionRecords []types.RedemptionRecord)
- func (k Keeper) GetAllSlashRecords(ctx sdk.Context) (slashRecords []types.SlashRecord)
- func (k Keeper) GetAllTransferInProgressId(ctx sdk.Context) (transferInProgressRecordIds []types.TransferInProgressRecordIds)
- func (k Keeper) GetAllUnbondingRecordsByStatus(ctx sdk.Context, status types.UnbondingRecordStatus) (unbondingRecords []types.UnbondingRecord)
- func (k Keeper) GetArchivedDelegationRecord(ctx sdk.Context, recordId uint64) (delegationRecord types.DelegationRecord, found bool)
- func (k Keeper) GetArchivedUnbondingRecord(ctx sdk.Context, recordId uint64) (unbondingRecord types.UnbondingRecord, found bool)
- func (k Keeper) GetDelegationRecord(ctx sdk.Context, recordId uint64) (delegationRecord types.DelegationRecord, found bool)
- func (k Keeper) GetHostZone(ctx sdk.Context) (hostZone types.HostZone, err error)
- func (k Keeper) GetRedemptionRecord(ctx sdk.Context, unbondingRecordId uint64, address string) (redemptionRecord types.RedemptionRecord, found bool)
- func (k Keeper) GetRedemptionRecordsFromAddress(ctx sdk.Context, address string) (redemptionRecords []types.RedemptionRecord)
- func (k Keeper) GetRedemptionRecordsFromUnbondingId(ctx sdk.Context, unbondingRecordId uint64) (redemptionRecords []types.RedemptionRecord)
- func (k Keeper) GetTransferInProgressRecordId(ctx sdk.Context, channelId string, sequence uint64) (recordId uint64, found bool)
- func (k Keeper) GetUnbondingRecord(ctx sdk.Context, recordId uint64) (unbondingRecord types.UnbondingRecord, found bool)
- func (k Keeper) GetUnhaltedHostZone(ctx sdk.Context) (hostZone types.HostZone, err error)
- func (k Keeper) HaltZone(ctx sdk.Context)
- func (k Keeper) Hooks() Hooks
- func (k Keeper) HostZone(c context.Context, req *types.QueryHostZoneRequest) (*types.QueryHostZoneResponse, error)
- func (k Keeper) IncrementSlashRecordId(ctx sdk.Context) uint64
- func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
- func (k Keeper) LiquidStake(ctx sdk.Context, liquidStaker string, nativeAmount sdkmath.Int) (stToken sdk.Coin, err error)
- func (k Keeper) LiquidStakeAndDistributeFees(ctx sdk.Context) error
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MarkFinishedUnbondings(ctx sdk.Context)
- func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte) error
- func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) error
- func (k Keeper) PostRedemptionRateToOracles(ctx sdk.Context) error
- func (k Keeper) PrepareDelegation(ctx sdk.Context, epochNumber uint64, epochDuration time.Duration) error
- func (k Keeper) PrepareUndelegation(ctx sdk.Context, epochNumber uint64) error
- func (k Keeper) RedeemStake(ctx sdk.Context, redeemer string, stTokenAmount sdkmath.Int) (nativeToken sdk.Coin, err error)
- func (k Keeper) RedemptionRecord(c context.Context, req *types.QueryRedemptionRecordRequest) (*types.QueryRedemptionRecordResponse, error)
- func (k Keeper) RedemptionRecords(c context.Context, req *types.QueryRedemptionRecordsRequest) (*types.QueryRedemptionRecordsResponse, error)
- func (k Keeper) RemoveDelegationRecord(ctx sdk.Context, recordId uint64)
- func (k Keeper) RemoveHostZone(ctx sdk.Context)
- func (k Keeper) RemoveRedemptionRecord(ctx sdk.Context, unbondingRecordId uint64, address string)
- func (k Keeper) RemoveTransferInProgressRecordId(ctx sdk.Context, channelId string, sequence uint64)
- func (k Keeper) RemoveUnbondingRecord(ctx sdk.Context, recordId uint64)
- func (k Keeper) SafelyDistributeClaims(ctx sdk.Context) error
- func (k Keeper) SafelyLiquidStakeAndDistributeFees(ctx sdk.Context) error
- func (k Keeper) SafelyPrepareDelegation(ctx sdk.Context, epochNumber uint64, epochDuration time.Duration) error
- func (k Keeper) SafelyPrepareUndelegation(ctx sdk.Context, epochNumber uint64) error
- func (k Keeper) SafelySetDelegationRecord(ctx sdk.Context, delegationRecord types.DelegationRecord) error
- func (k Keeper) SafelySetUnbondingRecord(ctx sdk.Context, unbondingRecord types.UnbondingRecord) error
- func (k Keeper) SetArchivedDelegationRecord(ctx sdk.Context, delegationRecord types.DelegationRecord)
- func (k Keeper) SetArchivedUnbondingRecord(ctx sdk.Context, unbondingRecord types.UnbondingRecord)
- func (k Keeper) SetDelegationRecord(ctx sdk.Context, delegationRecord types.DelegationRecord)
- func (k Keeper) SetHostZone(ctx sdk.Context, hostZone types.HostZone)
- func (k Keeper) SetRedemptionRecord(ctx sdk.Context, redemptionRecord types.RedemptionRecord)
- func (k Keeper) SetSlashRecord(ctx sdk.Context, slashRecord types.SlashRecord)
- func (k Keeper) SetTransferInProgressRecordId(ctx sdk.Context, channelId string, sequence uint64, recordId uint64)
- func (k Keeper) SetUnbondingRecord(ctx sdk.Context, unbondingRecord types.UnbondingRecord)
- func (k Keeper) SlashRecords(c context.Context, req *types.QuerySlashRecordsRequest) (*types.QuerySlashRecordsResponse, error)
- func (k Keeper) UnbondingRecords(c context.Context, req *types.QueryUnbondingRecordsRequest) (*types.QueryUnbondingRecordsResponse, error)
- func (k Keeper) UpdateRedemptionRate(ctx sdk.Context) error
- func (k Keeper) VerifyImpliedRedemptionRateFromUnbonding(ctx sdk.Context, stTokenSupplyBefore sdkmath.Int, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmitHaltZoneEvent ¶
Emits an event indicating a zone was halted
func EmitSuccessfulConfirmDelegationEvent ¶
func EmitSuccessfulConfirmDelegationEvent(ctx sdk.Context, recordId uint64, delegationAmount sdkmath.Int, txHash string, sender string)
Emits an event indicated the delegation record is correctly marked as done
func EmitSuccessfulConfirmUnbondedTokenSweepEvent ¶
func EmitSuccessfulConfirmUnbondedTokenSweepEvent(ctx sdk.Context, recordId uint64, nativeAmount sdkmath.Int, txHash string, sender string)
Emits an event indicated the unbonding record is correctly marked as claimable
func EmitSuccessfulConfirmUndelegationEvent ¶
func EmitSuccessfulConfirmUndelegationEvent(ctx sdk.Context, recordId uint64, nativeAmount sdkmath.Int, txHash string, sender string)
Emits an event indicated the undelegation record is correctly marked as unbonding_in_progress
func EmitSuccessfulLiquidStakeEvent ¶
func EmitSuccessfulLiquidStakeEvent(ctx sdk.Context, staker string, hostZone types.HostZone, nativeAmount, stAmount sdkmath.Int)
Emits a successful liquid stake event, and displays metadata such as the stToken amount
func EmitSuccessfulRedeemStakeEvent ¶
func EmitSuccessfulRedeemStakeEvent(ctx sdk.Context, staker string, hostZone types.HostZone, nativeAmount, stAmount sdkmath.Int)
Emits a successful redeem stake event, and displays metadata such as the native amount
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
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)
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey storetypes.StoreKey, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, icaOracleKeeper types.ICAOracleKeeper, ratelimitKeeper types.RatelimitKeeper, transferKeeper types.TransferKeeper, ) *Keeper
func (Keeper) ArchiveDelegationRecord ¶
func (k Keeper) ArchiveDelegationRecord(ctx sdk.Context, delegationRecord types.DelegationRecord)
Removes a delegation record from the active store and writes it to the archive store, to preserve history
func (Keeper) ArchiveFailedTransferRecord ¶
func (Keeper) ArchiveUnbondingRecord ¶
func (k Keeper) ArchiveUnbondingRecord(ctx sdk.Context, unbondingRecord types.UnbondingRecord)
Removes a unbonding record from the active store, and writes it to the archive store to preserve history
func (Keeper) BeforeEpochStart ¶
func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochInfo epochstypes.EpochInfo)
This module has the following epochly triggers
- Handle delegations daily
- Handle undelegations every 4 days
- Updates the redemption rate daily
- Check for completed unbondings hourly
- Process claims (if applicable) hourly
Note: The hourly processes are meant for actions that should run ASAP, but the hourly buffer makes it less expensive
func (Keeper) BeginBlocker ¶
func (Keeper) BurnRedeemedStTokens ¶
func (k Keeper) BurnRedeemedStTokens(ctx sdk.Context, stTokensToBurn sdk.Coins, redemptionAddress string) error
Burn stTokens from the redemption account - this requires sending them to an module account first, then burning them from there. - we use the staketia module account
func (Keeper) CheckIsOperatorAddress ¶
CheckIsOperatorAddress checks if the given address is EITHER the safe admin OR operator admin address
func (Keeper) CheckIsSafeAddress ¶
CheckIsSafeAddress checks if the given address is the safe admin address
func (Keeper) CheckIsSafeOrOperatorAddress ¶
CheckIsSafeOrOperatorAddress checks if the given address is EITHER the safe admin OR operator admin address
func (Keeper) CheckRedemptionRateExceedsBounds ¶
Checks whether the redemption rate has exceeded the inner or outer safety bounds and returns an error if so
func (Keeper) ConfirmDelegation ¶
func (k Keeper) ConfirmDelegation(ctx sdk.Context, recordId uint64, txHash string, sender string) (err error)
Confirms a delegation has completed on the host zone, increments the internal delegated balance, and archives the record
func (Keeper) ConfirmUnbondedTokenSweep ¶
func (k Keeper) ConfirmUnbondedTokenSweep(ctx sdk.Context, recordId uint64, txHash string, sender string) (err error)
Confirms that unbonded tokens have been sent back to stride and marks the unbonding record CLAIMABLE
func (Keeper) ConfirmUndelegation ¶
func (k Keeper) ConfirmUndelegation(ctx sdk.Context, recordId uint64, txHash string, sender string) (err error)
Confirms that an undelegation has been completed on the host zone Updates the record status to UNBONDING_IN_PROGRESS, decrements the delegated balance and burns stTokens
func (Keeper) DelegationRecords ¶
func (k Keeper) DelegationRecords(c context.Context, req *types.QueryDelegationRecordsRequest) (*types.QueryDelegationRecordsResponse, error)
Queries the delegation records with an optional to include archived records
func (Keeper) DistributeClaims ¶
Iterates all unbonding records and distributes unbonded tokens to redeemers This function will operate atomically by using a cache context wrapper when it's invoked. This means that if any redemption send fails across any unbonding records, all partial state will be reverted
func (Keeper) DistributeClaimsForUnbondingRecord ¶
func (k Keeper) DistributeClaimsForUnbondingRecord( ctx sdk.Context, hostNativeIbcDenom string, claimAddress sdk.AccAddress, unbondingRecordId uint64, ) error
Distribute claims for a given unbonding record
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
Exports the current state
func (Keeper) GetAccumulatingUnbondingRecord ¶
func (k Keeper) GetAccumulatingUnbondingRecord(ctx sdk.Context) (unbondingRecord types.UnbondingRecord, err error)
Gets the ACCUMULATING unbonding record (there should only be one)
func (Keeper) GetAllActiveDelegationRecords ¶
func (k Keeper) GetAllActiveDelegationRecords(ctx sdk.Context) (delegationRecords []types.DelegationRecord)
Returns all active delegation records
func (Keeper) GetAllActiveUnbondingRecords ¶
func (k Keeper) GetAllActiveUnbondingRecords(ctx sdk.Context) (unbondingRecords []types.UnbondingRecord)
Returns all active unbonding records
func (Keeper) GetAllArchivedDelegationRecords ¶
func (k Keeper) GetAllArchivedDelegationRecords(ctx sdk.Context) (delegationRecords []types.DelegationRecord)
Returns all active delegation records
func (Keeper) GetAllArchivedUnbondingRecords ¶
func (k Keeper) GetAllArchivedUnbondingRecords(ctx sdk.Context) (unbondingRecords []types.UnbondingRecord)
Returns all unbonding records that have been archived
func (Keeper) GetAllRedemptionRecords ¶
func (k Keeper) GetAllRedemptionRecords(ctx sdk.Context) (redemptionRecords []types.RedemptionRecord)
Returns all redemption records
func (Keeper) GetAllSlashRecords ¶
func (k Keeper) GetAllSlashRecords(ctx sdk.Context) (slashRecords []types.SlashRecord)
Returns all slash records
func (Keeper) GetAllTransferInProgressId ¶
func (k Keeper) GetAllTransferInProgressId(ctx sdk.Context) (transferInProgressRecordIds []types.TransferInProgressRecordIds)
Get all pending transfers
func (Keeper) GetAllUnbondingRecordsByStatus ¶
func (k Keeper) GetAllUnbondingRecordsByStatus(ctx sdk.Context, status types.UnbondingRecordStatus) (unbondingRecords []types.UnbondingRecord)
Returns all unbonding records with a specific status Searches only active records
func (Keeper) GetArchivedDelegationRecord ¶
func (k Keeper) GetArchivedDelegationRecord(ctx sdk.Context, recordId uint64) (delegationRecord types.DelegationRecord, found bool)
Reads a delegation record from the archive store
func (Keeper) GetArchivedUnbondingRecord ¶
func (k Keeper) GetArchivedUnbondingRecord(ctx sdk.Context, recordId uint64) (unbondingRecord types.UnbondingRecord, found bool)
Reads a unbonding record from the archive store
func (Keeper) GetDelegationRecord ¶
func (k Keeper) GetDelegationRecord(ctx sdk.Context, recordId uint64) (delegationRecord types.DelegationRecord, found bool)
Reads a delegation record from the active store
func (Keeper) GetHostZone ¶
Reads a host zone from the store There should always be a host zone, so this should error if it is not found
func (Keeper) GetRedemptionRecord ¶
func (k Keeper) GetRedemptionRecord(ctx sdk.Context, unbondingRecordId uint64, address string) (redemptionRecord types.RedemptionRecord, found bool)
Reads a redemption record from the store
func (Keeper) GetRedemptionRecordsFromAddress ¶
func (k Keeper) GetRedemptionRecordsFromAddress(ctx sdk.Context, address string) (redemptionRecords []types.RedemptionRecord)
Returns all redemption records for a given address
func (Keeper) GetRedemptionRecordsFromUnbondingId ¶
func (k Keeper) GetRedemptionRecordsFromUnbondingId(ctx sdk.Context, unbondingRecordId uint64) (redemptionRecords []types.RedemptionRecord)
Returns all redemption records for a given unbonding record
func (Keeper) GetTransferInProgressRecordId ¶
func (k Keeper) GetTransferInProgressRecordId(ctx sdk.Context, channelId string, sequence uint64) (recordId uint64, found bool)
Gets the record ID for a pending outbound transfer of native tokens
func (Keeper) GetUnbondingRecord ¶
func (k Keeper) GetUnbondingRecord(ctx sdk.Context, recordId uint64) (unbondingRecord types.UnbondingRecord, found bool)
Reads a unbonding record from the active store
func (Keeper) GetUnhaltedHostZone ¶
Reads a host zone from the store and errors if the host zone is halted
func (Keeper) HostZone ¶
func (k Keeper) HostZone(c context.Context, req *types.QueryHostZoneRequest) (*types.QueryHostZoneResponse, error)
Queries the host zone struct
func (Keeper) IncrementSlashRecordId ¶
Increments the current slash record ID and returns the new ID
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
Initializes the genesis state in the store
func (Keeper) LiquidStake ¶
func (k Keeper) LiquidStake(ctx sdk.Context, liquidStaker string, nativeAmount sdkmath.Int) (stToken sdk.Coin, err error)
Liquid stakes native tokens and returns stTokens to the user The staker's native tokens (which exist as an IBC denom on stride) are escrowed in the deposit account StTokens are minted at the current redemption rate
func (Keeper) LiquidStakeAndDistributeFees ¶
Liquid stakes tokens in the fee account and distributes them to the fee collector
func (Keeper) MarkFinishedUnbondings ¶
Checks for any unbonding records that have finished unbonding, identified by having status UNBONDING_IN_PROGRESS and an unbonding that's older than the current time. Records are annotated with a new status UNBONDED
func (Keeper) OnAcknowledgementPacket ¶
func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte) error
OnAcknowledgementPacket success: Update the DelegationRecord's status to DELEGATION_QUEUE OnAcknowledgementPacket failure: Delete the DelegationRecord
func (Keeper) OnTimeoutPacket ¶
OnTimeoutPacket: Delete the DelegationRecord
func (Keeper) PostRedemptionRateToOracles ¶
Pushes a redemption rate update to the ICA oracle
func (Keeper) PrepareDelegation ¶
func (k Keeper) PrepareDelegation(ctx sdk.Context, epochNumber uint64, epochDuration time.Duration) error
IBC transfers all TIA in the deposit account and sends it to the delegation account
func (Keeper) PrepareUndelegation ¶
Freezes the ACCUMULATING record by changing the status to UNBONDING_QUEUE and updating the native token amounts on the unbonding and redemption records
func (Keeper) RedeemStake ¶
func (k Keeper) RedeemStake(ctx sdk.Context, redeemer string, stTokenAmount sdkmath.Int) (nativeToken sdk.Coin, err error)
Takes custody of staked tokens in an escrow account, updates the current accumulating UnbondingRecord with the amount taken, and creates or updates the RedemptionRecord for this user
func (Keeper) RedemptionRecord ¶
func (k Keeper) RedemptionRecord(c context.Context, req *types.QueryRedemptionRecordRequest) (*types.QueryRedemptionRecordResponse, error)
Queries a single user redemption record
func (Keeper) RedemptionRecords ¶
func (k Keeper) RedemptionRecords(c context.Context, req *types.QueryRedemptionRecordsRequest) (*types.QueryRedemptionRecordsResponse, error)
Queries all redemption records with an optional filter by address
func (Keeper) RemoveDelegationRecord ¶
Removes a delegation record from the active store
func (Keeper) RemoveHostZone ¶
Removes a host zone from the store Note: This is only for testing - it should never be used elsewhere
func (Keeper) RemoveRedemptionRecord ¶
Removes a redemption record from the store
func (Keeper) RemoveTransferInProgressRecordId ¶
func (k Keeper) RemoveTransferInProgressRecordId(ctx sdk.Context, channelId string, sequence uint64)
Remove the record ID for a pending outbound transfer of native tokens Happens after the packet acknowledement comes back to stride
func (Keeper) RemoveUnbondingRecord ¶
Removes an unbonding record from the active store
func (Keeper) SafelyDistributeClaims ¶
Runs distribute claims with a cache context wrapper so revert any partial state changes
func (Keeper) SafelyLiquidStakeAndDistributeFees ¶
Liquid stakes fees with a cache context wrapper so revert any partial state changes
func (Keeper) SafelyPrepareDelegation ¶
func (k Keeper) SafelyPrepareDelegation(ctx sdk.Context, epochNumber uint64, epochDuration time.Duration) error
Runs prepare delegations with a cache context wrapper so revert any partial state changes
func (Keeper) SafelyPrepareUndelegation ¶
Runs prepare undelegations with a cache context wrapper so revert any partial state changes
func (Keeper) SafelySetDelegationRecord ¶
func (k Keeper) SafelySetDelegationRecord(ctx sdk.Context, delegationRecord types.DelegationRecord) error
Writes a delegation record to the store only if a record does not already exist for that ID
func (Keeper) SafelySetUnbondingRecord ¶
func (k Keeper) SafelySetUnbondingRecord(ctx sdk.Context, unbondingRecord types.UnbondingRecord) error
Sets the unbonding record only if a record does not already exist for that ID
func (Keeper) SetArchivedDelegationRecord ¶
func (k Keeper) SetArchivedDelegationRecord(ctx sdk.Context, delegationRecord types.DelegationRecord)
Writes a delegation record to the archive store
func (Keeper) SetArchivedUnbondingRecord ¶
func (k Keeper) SetArchivedUnbondingRecord(ctx sdk.Context, unbondingRecord types.UnbondingRecord)
Writes an unbonding record to the archive store
func (Keeper) SetDelegationRecord ¶
func (k Keeper) SetDelegationRecord(ctx sdk.Context, delegationRecord types.DelegationRecord)
Writes a delegation record to the active store
func (Keeper) SetHostZone ¶
Writes a host zone to the store
func (Keeper) SetRedemptionRecord ¶
func (k Keeper) SetRedemptionRecord(ctx sdk.Context, redemptionRecord types.RedemptionRecord)
Writes a redemption record to the store
func (Keeper) SetSlashRecord ¶
func (k Keeper) SetSlashRecord(ctx sdk.Context, slashRecord types.SlashRecord)
Writes a slash record to the store
func (Keeper) SetTransferInProgressRecordId ¶
func (k Keeper) SetTransferInProgressRecordId(ctx sdk.Context, channelId string, sequence uint64, recordId uint64)
Stores the record ID for a pending outbound transfer of native tokens
func (Keeper) SetUnbondingRecord ¶
func (k Keeper) SetUnbondingRecord(ctx sdk.Context, unbondingRecord types.UnbondingRecord)
Writes an unbonding record to the active store
func (Keeper) SlashRecords ¶
func (k Keeper) SlashRecords(c context.Context, req *types.QuerySlashRecordsRequest) (*types.QuerySlashRecordsResponse, error)
Queries all slash records
func (Keeper) UnbondingRecords ¶
func (k Keeper) UnbondingRecords(c context.Context, req *types.QueryUnbondingRecordsRequest) (*types.QueryUnbondingRecordsResponse, error)
Queries the unbonding records with an optional to include archived records
func (Keeper) UpdateRedemptionRate ¶
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: tokens deposited from liquid stakes, that are still living on Stride 2. Undelegated Balance: tokens that are ready to be staked (they're either currently in the delegation account or currently being transferred there) 3. Delegated Balance: Delegations on the host zone StToken Amount: 1. Total Supply of the stToken Redemption Rate = (Deposit Account Balance + Undelegated Balance + Delegated Balance) / (stToken Supply)
Note: Reinvested tokens are sent to the deposit account and are automatically included in this formula
func (Keeper) VerifyImpliedRedemptionRateFromUnbonding ¶
func (k Keeper) VerifyImpliedRedemptionRateFromUnbonding(ctx sdk.Context, stTokenSupplyBefore sdkmath.Int, delegatedBalanceBefore sdkmath.Int) error
Sanity check helper for checking diffs on delegated balance and stToken supply are within outer RR bounds