keeper

package
v0.0.0-...-018c514 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unset           = "unset"
	ICAMsgChunkSize = 5
	ICATimeout      = time.Hour * 6
)
View Source
const (
	// setting WithdrawStatusTokenize as 0 causes the value to be omitted when (un)marshalling :/.
	WithdrawStatusTokenize  int32 = iota + 1
	WithdrawStatusQueued    int32 = iota + 1
	WithdrawStatusUnbond    int32 = iota + 1
	WithdrawStatusSend      int32 = iota + 1
	WithdrawStatusCompleted int32 = iota + 1
)

Variables

This section is empty.

Functions

func AccountBalanceCallback

func AccountBalanceCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error

AccountBalanceCallback is a callback handler for Balance queries.

func AllBalancesCallback

func AllBalancesCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error

func DelegationAccountBalanceCallback

func DelegationAccountBalanceCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error

DelegationAccountBalanceCallback is a callback handler for Balance queries.

func DelegationCallback

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

func DelegationsCallback

func DelegationsCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error

func DepositIntervalCallback

func DepositIntervalCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error

func DepositTxCallback

func DepositTxCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error

DepositTxCallback is a callback that verifies client chain state validity, gets Tx receipt and calls HandleReceiptForTransaction.

func DistributeRewardsFromWithdrawAccount

func DistributeRewardsFromWithdrawAccount(k *Keeper, ctx sdk.Context, args []byte, query queryTypes.Query) error

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func PerfBalanceCallback

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

func RewardsCallback

func RewardsCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error

func ValidatorCallback

func ValidatorCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error

func ValsetCallback

func ValsetCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error

Types

type Callback

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

type Callbacks

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

Callbacks wrapper struct for interchainstaking keeper.

func (Callbacks) AddCallback

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

func (Callbacks) Call

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

Call calls callback handler.

func (Callbacks) Has

func (c Callbacks) Has(id string) bool

func (Callbacks) RegisterCallbacks

func (c Callbacks) RegisterCallbacks() icqtypes.QueryCallbacks

type Hooks

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

Hooks wrapper struct for interchainstaking keeper.

func (Hooks) AfterEpochEnd

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

func (Hooks) BeforeEpochStart

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

type Keeper

type Keeper struct {
	ICAControllerKeeper icacontrollerkeeper.Keeper
	ICQKeeper           interchainquerykeeper.Keeper
	AccountKeeper       types.AccountKeeper
	BankKeeper          types.BankKeeper
	IBCKeeper           ibckeeper.Keeper
	TransferKeeper      ibctransferkeeper.Keeper
	ClaimsManagerKeeper claimsmanagerkeeper.Keeper
	Ir                  codectypes.InterfaceRegistry
	// contains filtered or unexported fields
}

Keeper of this module maintains collections of registered zones.

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	storeKey storetypes.StoreKey,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	icaControllerKeeper icacontrollerkeeper.Keeper,
	scopedKeeper *capabilitykeeper.ScopedKeeper,
	icqKeeper interchainquerykeeper.Keeper,
	ibcKeeper ibckeeper.Keeper,
	transferKeeper ibctransferkeeper.Keeper,
	claimsManagerKeeper claimsmanagerkeeper.Keeper,
	ps paramtypes.Subspace,
) Keeper

NewKeeper returns a new instance of zones Keeper. This function will panic on failure.

func (*Keeper) AddWithdrawalRecord

func (k *Keeper) AddWithdrawalRecord(ctx sdk.Context, chainID, delegator string, distribution []*types.Distribution, recipient string, amount sdk.Coins, burnAmount sdk.Coin, hash string, status int32, completionTime time.Time)

func (*Keeper) AfterEpochEnd

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

AfterEpochEnd is called after any registered epoch ends. calls:

k.AggregateDelegatorIntents
k.HandleQueuedUnbondings
k.Rebalance

and re-queries icq for new zone info.

func (*Keeper) AggregateDelegatorIntents

func (k *Keeper) AggregateDelegatorIntents(ctx sdk.Context, zone *types.Zone) error

AggregateDelegatorIntents takes a snapshot of delegator intents for a given zone.

func (*Keeper) AllDelegatorIntents

func (k *Keeper) AllDelegatorIntents(ctx sdk.Context, zone *types.Zone, snapshot bool) []types.DelegatorIntent

AllDelegatorIntents returns every intent in the store for the specified zone.

func (*Keeper) AllDelegatorIntentsAsPointer

func (k *Keeper) AllDelegatorIntentsAsPointer(ctx sdk.Context, zone *types.Zone, snapshot bool) []*types.DelegatorIntent

AllDelegatorIntentsAsPointer returns every intent in the store for the specified zone.

func (*Keeper) AllPortConnections

func (k *Keeper) AllPortConnections(ctx sdk.Context) (pcs []types.PortConnectionTuple)

AllPortConnections returns all delegations used during genesis dump.

func (*Keeper) AllReceipts

func (k *Keeper) AllReceipts(ctx sdk.Context) []types.Receipt

func (*Keeper) AllRedelegationRecords

func (k *Keeper) AllRedelegationRecords(ctx sdk.Context) []types.RedelegationRecord

AllRedelegationRecords returns every record in the store for the specified zone.

func (*Keeper) AllUnbondingRecords

func (k *Keeper) AllUnbondingRecords(ctx sdk.Context) []types.UnbondingRecord

AllUnbondingRecords returns every record in the store.

func (*Keeper) AllWithdrawalRecords

func (k *Keeper) AllWithdrawalRecords(ctx sdk.Context) []types.WithdrawalRecord

AllWithdrawalRecords returns every record in the store for the specified zone.

func (*Keeper) AllZoneUnbondingRecords

func (k *Keeper) AllZoneUnbondingRecords(ctx sdk.Context, chainID string) []types.UnbondingRecord

AllZoneUnbondingRecords returns every record in the store for the specified zone.

func (*Keeper) AllZoneWithdrawalRecords

func (k *Keeper) AllZoneWithdrawalRecords(ctx sdk.Context, chainID string) []types.WithdrawalRecord

AllZoneWithdrawalRecords returns every record in the store for the specified zone.

func (*Keeper) AllZones

func (k *Keeper) AllZones(ctx sdk.Context) []types.Zone

AllZones returns every Zone in the store.

func (*Keeper) BeforeEpochStart

func (k *Keeper) BeforeEpochStart(_ sdk.Context, _ string, _ int64) error

func (*Keeper) BeginBlocker

func (k *Keeper) BeginBlocker(ctx sdk.Context)

BeginBlocker of interchainstaking module.

func (*Keeper) CallbackHandler

func (k *Keeper) CallbackHandler() Callbacks

func (*Keeper) CheckTMHeaderForZone

func (k *Keeper) CheckTMHeaderForZone(ctx sdk.Context, zone *types.Zone, res icqtypes.GetTxWithProofResponse) error

CheckTMHeaderForZone verifies the Tendermint consensus and client states for a given zone. Returns error if unable to verify.

func (*Keeper) ClaimCapability

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

ClaimCapability claims the channel capability passed via the OnOpenChanInit callback.

func (*Keeper) CollectStatsForZone

func (k *Keeper) CollectStatsForZone(ctx sdk.Context, zone *types.Zone) (*types.Statistics, error)

func (*Keeper) CurrentDelegationsAsIntent

func (k *Keeper) CurrentDelegationsAsIntent(ctx sdk.Context, zone *types.Zone) types.ValidatorIntents

func (*Keeper) DefaultAggregateIntents

func (k *Keeper) DefaultAggregateIntents(ctx sdk.Context, chainID string) types.ValidatorIntents

DefaultAggregateIntents determines the default aggregate intent (for epoch 0).

func (*Keeper) DelegatorIntent

DelegatorIntent returns information about the delegation intent of the caller for the given zone.

func (*Keeper) DeleteAddressZoneMapping

func (k *Keeper) DeleteAddressZoneMapping(ctx sdk.Context, address string)

DeleteAddressZoneMapping delete zone info.

func (*Keeper) DeleteDelegatorIntent

func (k *Keeper) DeleteDelegatorIntent(ctx sdk.Context, zone *types.Zone, delegator string, snapshot bool)

DeleteDelegatorIntent deletes delegator intent.

func (*Keeper) DeleteReceipt

func (k *Keeper) DeleteReceipt(ctx sdk.Context, key string)

DeleteReceipt delete receipt info.

func (*Keeper) DeleteRedelegationRecord

func (k *Keeper) DeleteRedelegationRecord(ctx sdk.Context, chainID, source, destination string, epochNumber int64)

DeleteRedelegationRecord deletes Redelegation record.

func (*Keeper) DeleteRedelegationRecordByKey

func (k *Keeper) DeleteRedelegationRecordByKey(ctx sdk.Context, key []byte)

DeleteRedelegationRecordByKey deletes Redelegation record.

func (*Keeper) DeleteUnbondingRecord

func (k *Keeper) DeleteUnbondingRecord(ctx sdk.Context, chainID, validator string, epochNumber int64)

DeleteUnbondingRecord deletes unbonding record.

func (Keeper) DeleteValidator

func (k Keeper) DeleteValidator(ctx sdk.Context, chainID string, address []byte)

DeleteValidators delete validators.

func (*Keeper) DeleteWithdrawalRecord

func (k *Keeper) DeleteWithdrawalRecord(ctx sdk.Context, chainID, txhash string, status int32)

DeleteWithdrawalRecord deletes withdrawal record.

func (*Keeper) DeleteZone

func (k *Keeper) DeleteZone(ctx sdk.Context, chainID string)

DeleteZone delete zone info.

func (*Keeper) DepositAccount

DepositAccount returns the deposit account address for the given zone.

func (*Keeper) DeterminePlanForDelegation

func (k *Keeper) DeterminePlanForDelegation(ctx sdk.Context, zone *types.Zone, amount sdk.Coins) (map[string]sdkmath.Int, error)

func (*Keeper) DeterminePlanForUndelegation

func (k *Keeper) DeterminePlanForUndelegation(ctx sdk.Context, zone *types.Zone, amount sdk.Coins) (map[string]math.Int, error)

func (*Keeper) DistanceToTarget

func (k *Keeper) DistanceToTarget(ctx sdk.Context, zone *types.Zone) (float64, error)

func (*Keeper) EmitDepositIntervalQuery

func (k *Keeper) EmitDepositIntervalQuery(ctx sdk.Context, zone *types.Zone)

func (*Keeper) EmitPerformanceBalanceQuery

func (k *Keeper) EmitPerformanceBalanceQuery(ctx sdk.Context, zone *types.Zone) error

func (*Keeper) EmitValSetQuery

func (k *Keeper) EmitValSetQuery(ctx sdk.Context, connectionID, chainID string, validatorsReq stakingtypes.QueryValidatorsRequest, period sdkmath.Int) error

func (*Keeper) EmitValidatorQuery

func (k *Keeper) EmitValidatorQuery(ctx sdk.Context, connectionID, chainID string, validator stakingtypes.Validator)

func (*Keeper) EnsureWithdrawalAddresses

func (k *Keeper) EnsureWithdrawalAddresses(ctx sdk.Context, zone *types.Zone) error

func (*Keeper) FlushOutstandingDelegations

func (k *Keeper) FlushOutstandingDelegations(ctx sdk.Context, zone *types.Zone, delAddrBalance sdk.Coin) error

func (*Keeper) GCCompletedRedelegations

func (k *Keeper) GCCompletedRedelegations(ctx sdk.Context) error

func (*Keeper) GCCompletedUnbondings

func (k *Keeper) GCCompletedUnbondings(ctx sdk.Context, zone *types.Zone) error

func (Keeper) GetActiveValidators

func (k Keeper) GetActiveValidators(ctx sdk.Context, chainID string) []types.Validator

GetActiveValidators returns validators by chainID where status = BONDED.

func (*Keeper) GetAddressZoneMapping

func (k *Keeper) GetAddressZoneMapping(ctx sdk.Context, address string) (string, bool)

GetAddressZoneMapping returns zone <-> address mapping.

func (*Keeper) GetAggregateIntentOrDefault

func (k *Keeper) GetAggregateIntentOrDefault(ctx sdk.Context, z *types.Zone) (types.ValidatorIntents, error)

func (*Keeper) GetAllDelegations

func (k *Keeper) GetAllDelegations(ctx sdk.Context, zone *types.Zone) (delegations []types.Delegation)

GetAllDelegations returns all delegations used during genesis dump.

func (*Keeper) GetAllDelegationsAsPointer

func (k *Keeper) GetAllDelegationsAsPointer(ctx sdk.Context, zone *types.Zone) (delegations []*types.Delegation)

GetAllDelegations returns all delegations used during genesis dump.

func (*Keeper) GetAllPerformanceDelegations

func (k *Keeper) GetAllPerformanceDelegations(ctx sdk.Context, zone *types.Zone) (delegations []types.Delegation)

GetAllDelegations returns all delegations used during genesis dump.

func (*Keeper) GetAllPerformanceDelegationsAsPointer

func (k *Keeper) GetAllPerformanceDelegationsAsPointer(ctx sdk.Context, zone *types.Zone) (delegations []*types.Delegation)

GetAllDelegations returns all delegations used during genesis dump.

func (*Keeper) GetChainID

func (k *Keeper) GetChainID(ctx sdk.Context, connectionID string) (string, error)

func (*Keeper) GetChainIDFromContext

func (k *Keeper) GetChainIDFromContext(ctx sdk.Context) (string, error)

func (*Keeper) GetCodec

func (k *Keeper) GetCodec() codec.Codec

func (*Keeper) GetCommissionRate

func (k *Keeper) GetCommissionRate(ctx sdk.Context) sdk.Dec

func (*Keeper) GetConnectionForPort

func (k *Keeper) GetConnectionForPort(ctx sdk.Context, port string) (string, error)

func (*Keeper) GetDelegatedAmount

func (k *Keeper) GetDelegatedAmount(ctx sdk.Context, zone *types.Zone) sdk.Coin

func (*Keeper) GetDelegation

func (k *Keeper) GetDelegation(ctx sdk.Context, zone *types.Zone, delegatorAddress, validatorAddress string) (delegation types.Delegation, found bool)

GetDelegation returns a specific delegation.

func (*Keeper) GetDelegationMap

func (k *Keeper) GetDelegationMap(ctx sdk.Context, zone *types.Zone) (out map[string]sdkmath.Int, sum sdkmath.Int, locked map[string]bool)

func (*Keeper) GetDelegationsInProcess

func (k *Keeper) GetDelegationsInProcess(ctx sdk.Context, zone *types.Zone) sdkmath.Int

func (*Keeper) GetDelegatorDelegations

func (k *Keeper) GetDelegatorDelegations(ctx sdk.Context, zone *types.Zone, delegator sdk.AccAddress) (delegations []types.Delegation)

GetDelegatorDelegations returns a given amount of all the delegations from a delegator.

func (*Keeper) GetDelegatorIntent

func (k *Keeper) GetDelegatorIntent(ctx sdk.Context, zone *types.Zone, delegator string, snapshot bool) (types.DelegatorIntent, bool)

GetDelegatorIntent returns intent info by zone and delegator.

func (*Keeper) GetGovAuthority

func (k *Keeper) GetGovAuthority(_ sdk.Context) string

func (*Keeper) GetLocalAddressMap

func (k *Keeper) GetLocalAddressMap(ctx sdk.Context, remoteAddress []byte, chainID string) ([]byte, bool)

GetLocalAddressMap retrieves a local address using a remote address.

func (*Keeper) GetNextWithdrawalRecordSequence

func (k *Keeper) GetNextWithdrawalRecordSequence(ctx sdk.Context) (sequence uint64)

func (*Keeper) GetParam

func (k *Keeper) GetParam(ctx sdk.Context, key []byte) uint64

func (*Keeper) GetParams

func (k *Keeper) GetParams(clientCtx sdk.Context) (params types.Params)

func (*Keeper) GetPerformanceDelegation

func (k *Keeper) GetPerformanceDelegation(ctx sdk.Context, zone *types.Zone, validatorAddress string) (delegation types.Delegation, found bool)

GetPerformanceDelegation returns a specific delegation.

func (*Keeper) GetRatio

func (k *Keeper) GetRatio(ctx sdk.Context, zone *types.Zone, epochRewards sdkmath.Int) (sdk.Dec, bool)

func (*Keeper) GetReceipt

func (k *Keeper) GetReceipt(ctx sdk.Context, key string) (types.Receipt, bool)

GetReceipt returns receipt for the given key.

func (*Keeper) GetRedelegationRecord

func (k *Keeper) GetRedelegationRecord(ctx sdk.Context, chainID, source, destination string, epochNumber int64) (types.RedelegationRecord, bool)

GetRedelegationRecord returns Redelegation record info by zone, validator and epoch.

func (*Keeper) GetRemoteAddressMap

func (k *Keeper) GetRemoteAddressMap(ctx sdk.Context, localAddress []byte, chainID string) ([]byte, bool)

GetRemoteAddressMap retrieves a remote address using a local address.

func (*Keeper) GetUnbondingAmount

func (k *Keeper) GetUnbondingAmount(ctx sdk.Context, zone *types.Zone) sdk.Coin

func (*Keeper) GetUnbondingEnabled

func (k *Keeper) GetUnbondingEnabled(ctx sdk.Context) bool

func (*Keeper) GetUnbondingRecord

func (k *Keeper) GetUnbondingRecord(ctx sdk.Context, chainID, validator string, epochNumber int64) (types.UnbondingRecord, bool)

GetUnbondingRecord returns unbonding record info by zone, validator and epoch.

func (*Keeper) GetUnlockedTokensForZone

func (k *Keeper) GetUnlockedTokensForZone(ctx sdk.Context, zone *types.Zone) (map[string]math.Int, math.Int, error)

GetUnlockedTokensForZone will iterate over all delegation records for a zone, and then remove the locked tokens (those actively being redelegated), returning a slice of int64 staking tokens that are unlocked and free to redelegate or unbond.

func (Keeper) GetValidator

func (k Keeper) GetValidator(ctx sdk.Context, chainID string, address []byte) (types.Validator, bool)

GetValidators returns validators by chainID.

func (Keeper) GetValidatorAddresses

func (k Keeper) GetValidatorAddresses(ctx sdk.Context, chainID string) []string

GetValidatorAddresses returns a slice of validator addresses by chainID.

func (*Keeper) GetValidatorForToken

func (k *Keeper) GetValidatorForToken(ctx sdk.Context, amount sdk.Coin) (string, error)

func (Keeper) GetValidators

func (k Keeper) GetValidators(ctx sdk.Context, chainID string) []types.Validator

GetValidators returns validators by chainID.

func (*Keeper) GetWithdrawalRecord

func (k *Keeper) GetWithdrawalRecord(ctx sdk.Context, chainID, txhash string, status int32) (types.WithdrawalRecord, bool)

GetWithdrawalRecord returns withdrawal record info by zone and delegator.

func (*Keeper) GetZone

func (k *Keeper) GetZone(ctx sdk.Context, chainID string) (types.Zone, bool)

GetZone returns zone info by chainID.

func (*Keeper) GetZoneForAccount

func (k *Keeper) GetZoneForAccount(ctx sdk.Context, address string) (zone *types.Zone)

func (*Keeper) GetZoneForDelegateAccount

func (k *Keeper) GetZoneForDelegateAccount(ctx sdk.Context, address string) *types.Zone

GetZoneForDelegateAccount determines the zone for a given address.

func (*Keeper) GetZoneForDepositAccount

func (k *Keeper) GetZoneForDepositAccount(ctx sdk.Context, address string) *types.Zone

func (*Keeper) GetZoneForPerformanceAccount

func (k *Keeper) GetZoneForPerformanceAccount(ctx sdk.Context, address string) *types.Zone

func (*Keeper) GetZoneFromContext

func (k *Keeper) GetZoneFromContext(ctx sdk.Context) (*types.Zone, error)

GetZoneFromContext determines the zone from the current context.

func (*Keeper) HandleAcknowledgement

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

func (*Keeper) HandleBeginRedelegate

func (k *Keeper) HandleBeginRedelegate(ctx sdk.Context, msg sdk.Msg, completion time.Time, memo string) error

func (*Keeper) HandleChannelOpenAck

func (k *Keeper) HandleChannelOpenAck(ctx sdk.Context, portID, connectionID string) error

func (*Keeper) HandleCompleteSend

func (k *Keeper) HandleCompleteSend(ctx sdk.Context, msg sdk.Msg, memo string) error

func (*Keeper) HandleDelegate

func (k *Keeper) HandleDelegate(ctx sdk.Context, msg sdk.Msg, memo string) error

func (*Keeper) HandleDistributeFeesFromModuleAccount

func (k *Keeper) HandleDistributeFeesFromModuleAccount(ctx sdk.Context) error

func (*Keeper) HandleFailedBeginRedelegate

func (k *Keeper) HandleFailedBeginRedelegate(ctx sdk.Context, msg sdk.Msg, memo string) error

func (*Keeper) HandleFailedUndelegate

func (k *Keeper) HandleFailedUndelegate(ctx sdk.Context, msg sdk.Msg, memo string) error

func (*Keeper) HandleMaturedUnbondings

func (k *Keeper) HandleMaturedUnbondings(ctx sdk.Context, zone *types.Zone) error

func (*Keeper) HandleMsgTransfer

func (k *Keeper) HandleMsgTransfer(ctx sdk.Context, msg sdk.Msg) error

func (*Keeper) HandleQueuedUnbondings

func (k *Keeper) HandleQueuedUnbondings(ctx sdk.Context, zone *types.Zone, epoch int64) error

HandleQueuedUnbondings is called once per epoch to aggregate all queued unbondings into a single unbond transaction per delegation.

func (*Keeper) HandleReceiptTransaction

func (k *Keeper) HandleReceiptTransaction(ctx sdk.Context, txn *tx.Tx, hash string, zone types.Zone) error

func (*Keeper) HandleRedeemTokens

func (k *Keeper) HandleRedeemTokens(ctx sdk.Context, msg sdk.Msg, amount sdk.Coin) error

func (*Keeper) HandleRegisterZoneProposal

func (k *Keeper) HandleRegisterZoneProposal(ctx sdk.Context, p *types.RegisterZoneProposal) error

HandleRegisterZoneProposal is a handler for executing a passed community spend proposal.

func (*Keeper) HandleTimeout

func (k *Keeper) HandleTimeout(_ sdk.Context, _ channeltypes.Packet) error

func (*Keeper) HandleTokenizedShares

func (k *Keeper) HandleTokenizedShares(ctx sdk.Context, msg sdk.Msg, sharesAmount sdk.Coin, memo string) error

func (*Keeper) HandleUndelegate

func (k *Keeper) HandleUndelegate(ctx sdk.Context, msg sdk.Msg, completion time.Time, memo string) error

func (*Keeper) HandleUpdateZoneProposal

func (k *Keeper) HandleUpdateZoneProposal(ctx sdk.Context, p *types.UpdateZoneProposal) error

HandleUpdateZoneProposal is a handler for executing a passed community spend proposal.

func (*Keeper) HandleUpdatedWithdrawAddress

func (k *Keeper) HandleUpdatedWithdrawAddress(ctx sdk.Context, msg sdk.Msg) error

func (*Keeper) HandleWithdrawForUser

func (k *Keeper) HandleWithdrawForUser(ctx sdk.Context, zone *types.Zone, msg *banktypes.MsgSend, memo string) error

HandleWithdrawForUser handles withdraw for user will check that the msgSend we have successfully executed matches an existing withdrawal record. on a match (recipient = msg.ToAddress + amount + status == SEND), we mark the record as complete. if no other withdrawal records exist for this triple (i.e. no further withdrawal from this delegator account for this user (i.e. different validator)) then burn the withdrawal_record's burn_amount.

func (*Keeper) HandleWithdrawRewards

func (k *Keeper) HandleWithdrawRewards(ctx sdk.Context, msg sdk.Msg) error

func (*Keeper) Hooks

func (k *Keeper) Hooks() Hooks

func (*Keeper) IterateAllDelegations

func (k *Keeper) IterateAllDelegations(ctx sdk.Context, zone *types.Zone, cb func(delegation types.Delegation) (stop bool))

IterateAllDelegations iterates through all of the delegations.

func (*Keeper) IterateAllPerformanceDelegations

func (k *Keeper) IterateAllPerformanceDelegations(ctx sdk.Context, zone *types.Zone, cb func(delegation types.Delegation) (stop bool))

IterateAllPerformanceDelegations iterates through all of the delegations.

func (*Keeper) IterateDelegatorDelegations

func (k *Keeper) IterateDelegatorDelegations(ctx sdk.Context, zone *types.Zone, delegator sdk.AccAddress, cb func(delegation types.Delegation) (stop bool))

IterateDelegatorDelegations iterates through one delegator's delegations.

func (*Keeper) IterateDelegatorIntents

func (k *Keeper) IterateDelegatorIntents(ctx sdk.Context, zone *types.Zone, snapshot bool, fn func(index int64, intent types.DelegatorIntent) (stop bool))

IterateDelegatorIntents iterate through delegator intents for a given zone.

func (*Keeper) IteratePortConnections

func (k *Keeper) IteratePortConnections(ctx sdk.Context, cb func(pc types.PortConnectionTuple) (stop bool))

IteratePortConnections iterates through all of the delegations.

func (*Keeper) IteratePrefixedRedelegationRecords

func (k *Keeper) IteratePrefixedRedelegationRecords(ctx sdk.Context, prefixBytes []byte, fn func(index int64, key []byte, record types.RedelegationRecord) (stop bool))

IteratePrefixedRedelegationRecords iterate through all records with given prefix.

func (*Keeper) IteratePrefixedUnbondingRecords

func (k *Keeper) IteratePrefixedUnbondingRecords(ctx sdk.Context, prefixBytes []byte, fn func(index int64, record types.UnbondingRecord) (stop bool))

IteratePrefixedUnbondingRecords iterate through all records with given prefix.

func (*Keeper) IteratePrefixedWithdrawalRecords

func (k *Keeper) IteratePrefixedWithdrawalRecords(ctx sdk.Context, prefixBytes []byte, fn func(index int64, record types.WithdrawalRecord) (stop bool))

IteratePrefixedWithdrawalRecords iterate through all records with given prefix.

func (*Keeper) IterateReceipts

func (k *Keeper) IterateReceipts(ctx sdk.Context, fn func(index int64, receiptInfo types.Receipt) (stop bool))

IterateReceipts iterate through receipts.

func (*Keeper) IterateRedelegationRecords

func (k *Keeper) IterateRedelegationRecords(ctx sdk.Context, fn func(index int64, key []byte, record types.RedelegationRecord) (stop bool))

IterateRedelegationRecords iterate through all records.

func (*Keeper) IterateUnbondingRecords

func (k *Keeper) IterateUnbondingRecords(ctx sdk.Context, fn func(index int64, record types.UnbondingRecord) (stop bool))

IterateUnbondingRecords iterate through all records.

func (Keeper) IterateUserMappedAccounts

func (k Keeper) IterateUserMappedAccounts(ctx sdk.Context, localAddress []byte, fn func(index int64, chainID string, remoteAddressBytes []byte) (stop bool))

IterateUserMappedAccounts iterates over all the user mapped accounts.

func (Keeper) IterateValidators

func (k Keeper) IterateValidators(ctx sdk.Context, chainID string, fn func(index int64, validator types.Validator) (stop bool))

IterateZones iterates through zones.

func (*Keeper) IterateWithdrawalRecords

func (k *Keeper) IterateWithdrawalRecords(ctx sdk.Context, fn func(index int64, record types.WithdrawalRecord) (stop bool))

IterateWithdrawalRecords iterate through all records.

func (*Keeper) IterateZoneReceipts

func (k *Keeper) IterateZoneReceipts(ctx sdk.Context, zone *types.Zone, fn func(index int64, receiptInfo types.Receipt) (stop bool))

IterateZoneReceipts iterates through receipts of the given zone.

func (*Keeper) IterateZoneStatusWithdrawalRecords

func (k *Keeper) IterateZoneStatusWithdrawalRecords(ctx sdk.Context, chainID string, status int32, fn func(index int64, record types.WithdrawalRecord) (stop bool))

IterateZoneStatusWithdrawalRecords iterate through records for a given zone / delegator tuple.

func (*Keeper) IterateZoneWithdrawalRecords

func (k *Keeper) IterateZoneWithdrawalRecords(ctx sdk.Context, chainID string, fn func(index int64, record types.WithdrawalRecord) (stop bool))

IterateZoneWithdrawalRecords iterate through records for a given zone.

func (*Keeper) IterateZones

func (k *Keeper) IterateZones(ctx sdk.Context, fn func(index int64, zone *types.Zone) (stop bool))

IterateZones iterate through zones.

func (*Keeper) Logger

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

Logger returns a module-specific logger.

func (*Keeper) MakePerformanceDelegation

func (k *Keeper) MakePerformanceDelegation(ctx sdk.Context, zone *types.Zone, validator string) error

func (*Keeper) MigrateParams

func (k *Keeper) MigrateParams(ctx sdk.Context)

MigrateParams fetches params, adds ClaimsEnabled field and re-sets params.

func (*Keeper) MintAndSendQAsset

func (k *Keeper) MintAndSendQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddress string, zone *types.Zone, assets sdk.Coins, memoRTS bool, mappedAddress []byte) error

MintAndSendQAsset mints qAssets based on the native asset redemption rate. Tokens are then transferred to the given user. The function handles the following cases:

  1. If the zone is labeled "return to sender" or the Tx memo contains "return to sender" flag: - Mint QAssets and IBC transfer to the corresponding zone acc
  2. If there is no mapped account but the zone is labeled as non-118 coin type: - Do not mint QAssets and refund assets
  3. If a mapped account is set for a non-118 coin type zone: - Mint QAssets and send to corresponding mapped address
  4. If a new mapped account is provided to the function and the zone is labeled as non-118 coin type: - Mint QAssets, set new mapping for the mapped account in the keeper, and send to corresponding mapped account.
  5. If the zone is 118 and no other flags are set: - Mint QAssets and transfer to send to msg creator.

func (Keeper) NewReceipt

func (k Keeper) NewReceipt(ctx sdk.Context, zone *types.Zone, sender, txhash string, amount sdk.Coins) *types.Receipt

func (Keeper) NilReceipt

func (k Keeper) NilReceipt(ctx sdk.Context, zone *types.Zone, txhash string)

func (*Keeper) OverrideRedemptionRateNoCap

func (k *Keeper) OverrideRedemptionRateNoCap(ctx sdk.Context, zone *types.Zone)

func (*Keeper) PrepareDelegationMessagesForCoins

func (k *Keeper) PrepareDelegationMessagesForCoins(zone *types.Zone, allocations map[string]sdkmath.Int) []sdk.Msg

func (*Keeper) PrepareDelegationMessagesForShares

func (k *Keeper) PrepareDelegationMessagesForShares(zone *types.Zone, coins sdk.Coins) []sdk.Msg

func (*Keeper) Rebalance

func (k *Keeper) Rebalance(ctx sdk.Context, zone *types.Zone, epochNumber int64) error

func (*Keeper) Receipts

func (*Keeper) RemoveDelegation

func (k *Keeper) RemoveDelegation(ctx sdk.Context, zone *types.Zone, delegation types.Delegation) error

RemoveDelegation removes a delegation.

func (*Keeper) RemoveZoneAndAssociatedRecords

func (k *Keeper) RemoveZoneAndAssociatedRecords(ctx sdk.Context, chainID string)

func (*Keeper) ScopedKeeper

func (k *Keeper) ScopedKeeper() *capabilitykeeper.ScopedKeeper

func (*Keeper) SendTokenIBC

func (k *Keeper) SendTokenIBC(ctx sdk.Context, senderAccAddress sdk.AccAddress, receiver string, zone *types.Zone, coin sdk.Coin) error

SendTokenIBC is a helper function that finds the zone channel and performs an ibc transfer from senderAccAddress to receiver.

func (*Keeper) SetAccountBalance

func (k *Keeper) SetAccountBalance(ctx sdk.Context, zone types.Zone, address string, queryResult []byte) error

SetAccountBalance triggers provable KV queries to prove an AllBalances query.

func (*Keeper) SetAccountBalanceForDenom

func (k *Keeper) SetAccountBalanceForDenom(ctx sdk.Context, zone *types.Zone, address string, coin sdk.Coin) error

SetAccountBalanceForDenom sets the balance on an account for a given denomination.

func (*Keeper) SetAddressMapPair

func (k *Keeper) SetAddressMapPair(ctx sdk.Context, localAddress, remoteAddress []byte, chainID string)

SetAddressMapPair sets forward and reverse maps for localAddress => remoteAddress and remoteAddress => localAddress.

func (*Keeper) SetAddressZoneMapping

func (k *Keeper) SetAddressZoneMapping(ctx sdk.Context, address, chainID string)

SetAddressZoneMapping set zone <-> address mapping.

func (*Keeper) SetConnectionForPort

func (k *Keeper) SetConnectionForPort(ctx sdk.Context, connectionID, port string)

func (*Keeper) SetDelegation

func (k *Keeper) SetDelegation(ctx sdk.Context, zone *types.Zone, delegation types.Delegation)

SetDelegation sets a delegation.

func (*Keeper) SetDelegatorIntent

func (k *Keeper) SetDelegatorIntent(ctx sdk.Context, zone *types.Zone, intent types.DelegatorIntent, snapshot bool)

SetDelegatorIntent store the delegator intent.

func (*Keeper) SetLocalAddressMap

func (k *Keeper) SetLocalAddressMap(ctx sdk.Context, localAddress, remoteAddress []byte, chainID string)

SetLocalAddressMap sets a local address using a remote address as a map.

func (*Keeper) SetParams

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

SetParams sets the distribution parameters to the param space.

func (*Keeper) SetPerformanceDelegation

func (k *Keeper) SetPerformanceDelegation(ctx sdk.Context, zone *types.Zone, delegation types.Delegation)

SetPerformanceDelegation sets a delegation.

func (*Keeper) SetReceipt

func (k *Keeper) SetReceipt(ctx sdk.Context, receipt types.Receipt)

SetReceipt sets receipt info.

func (*Keeper) SetReceiptsCompleted

func (k *Keeper) SetReceiptsCompleted(ctx sdk.Context, zone *types.Zone, qualifyingTime, completionTime time.Time)

func (*Keeper) SetRedelegationRecord

func (k *Keeper) SetRedelegationRecord(ctx sdk.Context, record types.RedelegationRecord)

SetRedelegationRecord store the Redelegation record.

func (*Keeper) SetRemoteAddressMap

func (k *Keeper) SetRemoteAddressMap(ctx sdk.Context, localAddress, remoteAddress []byte, chainID string)

SetRemoteAddressMap sets a remote address using a local address as a map.

func (*Keeper) SetUnbondingRecord

func (k *Keeper) SetUnbondingRecord(ctx sdk.Context, record types.UnbondingRecord)

SetUnbondingRecord store the unbonding record.

func (Keeper) SetValidator

func (k Keeper) SetValidator(ctx sdk.Context, chainID string, val types.Validator) error

SetValidators set validators.

func (*Keeper) SetValidatorForZone

func (k *Keeper) SetValidatorForZone(ctx sdk.Context, zone *types.Zone, data []byte) error

func (*Keeper) SetValidatorsForZone

func (k *Keeper) SetValidatorsForZone(ctx sdk.Context, data []byte, icqQuery icqtypes.Query) error

func (*Keeper) SetWithdrawalRecord

func (k *Keeper) SetWithdrawalRecord(ctx sdk.Context, record types.WithdrawalRecord)

SetWithdrawalRecord store the withdrawal record.

func (*Keeper) SetZone

func (k *Keeper) SetZone(ctx sdk.Context, zone *types.Zone)

SetZone set zone info.

func (*Keeper) SubmitTx

func (k *Keeper) SubmitTx(ctx sdk.Context, msgs []sdk.Msg, account *types.ICAAccount, memo string, messagesPerTx int64) error

SubmitTx submits a Tx on behalf of an ICAAccount to a remote chain.

func (*Keeper) TransferToDelegate

func (k *Keeper) TransferToDelegate(ctx sdk.Context, zone *types.Zone, coins sdk.Coins, memo string) error

TransferToDelegate transfers tokens from the zone deposit account address to the zone delegate account address.

func (*Keeper) TriggerRedemptionRate

func (k *Keeper) TriggerRedemptionRate(ctx sdk.Context, zone *types.Zone) error

func (*Keeper) UnmarshalValidator

func (k *Keeper) UnmarshalValidator(data []byte) (stakingtypes.Validator, error)

UnmarshalValidator attempts to umarshal a byte slice into a Validator.

func (*Keeper) UnmarshalValidatorsRequest

func (k *Keeper) UnmarshalValidatorsRequest(data []byte) (stakingtypes.QueryValidatorsRequest, error)

UnmarshalValidatorsRequest attempts to umarshal a byte slice into a QueryValidatorsRequest.

func (*Keeper) UnmarshalValidatorsResponse

func (k *Keeper) UnmarshalValidatorsResponse(data []byte) (stakingtypes.QueryValidatorsResponse, error)

UnmarshalValidatorsResponse attempts to umarshal a byte slice into a QueryValidatorsResponse.

func (*Keeper) UpdateDelegationRecordForAddress

func (k *Keeper) UpdateDelegationRecordForAddress(
	ctx sdk.Context,
	delegatorAddress,
	validatorAddress string,
	amount sdk.Coin,
	zone *types.Zone,
	absolute bool,
) error

func (*Keeper) UpdateDelegationRecordsForAddress

func (k *Keeper) UpdateDelegationRecordsForAddress(ctx sdk.Context, zone types.Zone, delegatorAddress string, args []byte) error

func (*Keeper) UpdateDelegatorIntent

func (k *Keeper) UpdateDelegatorIntent(ctx sdk.Context, delegator sdk.AccAddress, zone *types.Zone, inAmount sdk.Coins, memoIntent types.ValidatorIntents) error

UpdateDelegatorIntent updates delegator intents.

func (*Keeper) UpdatePerformanceDelegations

func (k *Keeper) UpdatePerformanceDelegations(ctx sdk.Context, zone types.Zone) error

func (*Keeper) UpdateRedemptionRate

func (k *Keeper) UpdateRedemptionRate(ctx sdk.Context, zone *types.Zone, epochRewards sdkmath.Int)

func (*Keeper) UpdateWithdrawalRecordStatus

func (k *Keeper) UpdateWithdrawalRecordStatus(ctx sdk.Context, withdrawal *types.WithdrawalRecord, newStatus int32)

func (*Keeper) UpdateWithdrawalRecordsForSlash

func (k *Keeper) UpdateWithdrawalRecordsForSlash(ctx sdk.Context, zone *types.Zone, valoper string, delta sdk.Dec) error

func (*Keeper) UserZoneReceipts

func (k *Keeper) UserZoneReceipts(ctx sdk.Context, zone *types.Zone, addr sdk.AccAddress) ([]types.Receipt, error)

UserZoneReceipts returns all receipts of the given user for the given zone.

func (*Keeper) WithdrawDelegationRewardsForResponse

func (k *Keeper) WithdrawDelegationRewardsForResponse(ctx sdk.Context, zone *types.Zone, delegator string, response []byte) error

func (*Keeper) Zone

Zone returns information about registered zones.

func (*Keeper) ZoneRedelegationRecords

func (k *Keeper) ZoneRedelegationRecords(ctx sdk.Context, chainID string) []types.RedelegationRecord

ZoneRedelegationRecords returns every record in the store for the specified zone.

func (*Keeper) Zones

Zones returns information about registered zones.

type TypedMsg

type TypedMsg struct {
	Msg  sdk.Msg
	Type string
}

func DeserializeCosmosTxTyped

func DeserializeCosmosTxTyped(cdc codec.BinaryCodec, data []byte) ([]TypedMsg, error)

Jump to

Keyboard shortcuts

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