Documentation ¶
Index ¶
- func GlobalStakingPoolInvariant(keeper Keeper) sdk.Invariant
- func ModuleAccountInvariant(keeper Keeper) sdk.Invariant
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
- func ProviderInvariant(keeper Keeper) sdk.Invariant
- func RandomDelegation(r *rand.Rand, k Keeper, ctx sdk.Context) (sdk.AccAddress, sdk.Int, bool)
- func RandomMaturedProposalIDReimbursementPair(r *rand.Rand, k Keeper, ctx sdk.Context) (types.ProposalIDReimbursementPair, bool)
- func RandomPoolInfo(r *rand.Rand, k Keeper, ctx sdk.Context) (uint64, string, bool)
- func RandomProvider(r *rand.Rand, k Keeper, ctx sdk.Context) (types.Provider, bool)
- func RandomPurchaseList(r *rand.Rand, k Keeper, ctx sdk.Context) (types.PurchaseList, bool)
- func RandomValidator(r *rand.Rand, k Keeper, ctx sdk.Context) (staking.Validator, bool)
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func ShieldInvariant(keeper Keeper) sdk.Invariant
- type Hooks
- func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, _ sdk.ValAddress)
- func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress)
- func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress)
- func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
- func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress)
- func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress)
- func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)
- type Keeper
- func (k Keeper) AddPurchase(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, ...) types.PurchaseList
- func (k Keeper) AddStaking(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, purchaseID uint64, ...) error
- func (k Keeper) BondDenom(ctx sdk.Context) string
- func (k Keeper) ClaimEnd(ctx sdk.Context, id, poolID uint64, loss sdk.Coins)
- func (q Keeper) ClaimParams(c context.Context, req *types.QueryClaimParamsRequest) (*types.QueryClaimParamsResponse, error)
- func (k Keeper) ClosePool(ctx sdk.Context, pool types.Pool)
- func (k Keeper) ClosePools(ctx sdk.Context)
- func (k Keeper) ComputeTotalUnbondingAmount(ctx sdk.Context, provider sdk.AccAddress) sdk.Int
- func (k Keeper) ComputeUnbondingAmountByTime(ctx sdk.Context, provider sdk.AccAddress, time time.Time) sdk.Int
- func (k Keeper) ComputeWithdrawAmountByTime(ctx sdk.Context, provider string, time time.Time) sdk.Int
- func (k Keeper) CreatePool(ctx sdk.Context, creator sdk.AccAddress, shield sdk.Coins, ...) (uint64, error)
- func (k Keeper) CreateReimbursement(ctx sdk.Context, proposalID uint64, amount sdk.Coins, ...) error
- func (k Keeper) DelayUnbonding(ctx sdk.Context, provider sdk.AccAddress, amount sdk.Int, ...) error
- func (k Keeper) DelayWithdraws(ctx sdk.Context, provider string, amount sdk.Int, delayedTime time.Time) error
- func (k Keeper) DeleteBlockServiceFees(ctx sdk.Context)
- func (k Keeper) DeletePurchaseList(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress) error
- func (k Keeper) DeleteReimbursement(ctx sdk.Context, proposalID uint64) error
- func (k Keeper) DepositCollateral(ctx sdk.Context, from sdk.AccAddress, amount sdk.Int) error
- func (k Keeper) DequeueCompletedWithdrawQueue(ctx sdk.Context)
- func (k Keeper) DequeuePurchase(ctx sdk.Context, purchaseList types.PurchaseList, timestamp time.Time)
- func (q Keeper) DistrParams(c context.Context, req *types.QueryDistrParamsRequest) (*types.QueryDistrParamsResponse, error)
- func (k Keeper) ExpiringPurchaseQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (k Keeper) FundShieldBlockRewards(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error
- func (k Keeper) GetAdmin(ctx sdk.Context) sdk.AccAddress
- func (k Keeper) GetAllOriginalStakings(ctx sdk.Context) (originalStakings []types.OriginalStaking)
- func (k Keeper) GetAllPools(ctx sdk.Context) (pools []types.Pool)
- func (k Keeper) GetAllProposalIDReimbursementPairs(ctx sdk.Context) []types.ProposalIDReimbursementPair
- func (k Keeper) GetAllProviders(ctx sdk.Context) (providers []types.Provider)
- func (k Keeper) GetAllPurchaseLists(ctx sdk.Context) (purchases []types.PurchaseList)
- func (k Keeper) GetAllPurchases(ctx sdk.Context) (purchases []types.Purchase)
- func (k Keeper) GetAllReimbursements(ctx sdk.Context) (rmbs []types.Reimbursement)
- func (k Keeper) GetAllStakeForShields(ctx sdk.Context) (purchases []types.ShieldStaking)
- func (k Keeper) GetAllWithdraws(ctx sdk.Context) (result []types.Withdraw)
- func (k Keeper) GetBlockServiceFees(ctx sdk.Context) types.MixedDecCoins
- func (k Keeper) GetClaimProposalParams(ctx sdk.Context) types.ClaimProposalParams
- func (k Keeper) GetDistributionParams(ctx sdk.Context) (distrParams types.DistributionParams)
- func (k Keeper) GetExpiringPurchaseQueueTimeSlice(ctx sdk.Context, timestamp time.Time) []types.PoolPurchaser
- func (k Keeper) GetGlobalShieldStakingPool(ctx sdk.Context) (pool sdk.Int)
- func (k Keeper) GetLastUpdateTime(ctx sdk.Context) (time.Time, bool)
- func (k Keeper) GetNextPoolID(ctx sdk.Context) uint64
- func (k Keeper) GetNextPurchaseID(ctx sdk.Context) uint64
- func (k Keeper) GetOriginalStaking(ctx sdk.Context, purchaseID uint64) sdk.Int
- func (k Keeper) GetPool(ctx sdk.Context, id uint64) (types.Pool, bool)
- func (k Keeper) GetPoolParams(ctx sdk.Context) types.PoolParams
- func (k Keeper) GetPoolPurchaseLists(ctx sdk.Context, poolID uint64) (purchases []types.PurchaseList)
- func (k Keeper) GetPoolsBySponsor(ctx sdk.Context, sponsorAddr string) ([]types.Pool, bool)
- func (k Keeper) GetProvider(ctx sdk.Context, delegator sdk.AccAddress) (dt types.Provider, found bool)
- func (k Keeper) GetProvidersIteratorPaginated(ctx sdk.Context, page, limit uint) sdk.Iterator
- func (k Keeper) GetProvidersPaginated(ctx sdk.Context, page, limit uint) (providers []types.Provider)
- func (Keeper) GetPurchase(purchaseList types.PurchaseList, purchaseID uint64) (types.Purchase, bool)
- func (k Keeper) GetPurchaseList(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress) (types.PurchaseList, bool)
- func (k Keeper) GetPurchaserPurchases(ctx sdk.Context, address sdk.AccAddress) (res []types.PurchaseList)
- func (k Keeper) GetReimbursement(ctx sdk.Context, proposalID uint64) (types.Reimbursement, error)
- func (k Keeper) GetRemainingServiceFees(ctx sdk.Context) types.MixedDecCoins
- func (k Keeper) GetServiceFees(ctx sdk.Context) types.MixedDecCoins
- func (k Keeper) GetShieldBlockRewardRatio(ctx sdk.Context) sdk.Dec
- func (k Keeper) GetShieldStakingRate(ctx sdk.Context) (rate sdk.Dec)
- func (k Keeper) GetSortedUnbondingDelegations(ctx sdk.Context, delAddr sdk.AccAddress) []stakingtypes.UnbondingDelegation
- func (k Keeper) GetStakeForShield(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress) (purchase types.ShieldStaking, found bool)
- func (k Keeper) GetTotalClaimed(ctx sdk.Context) sdk.Int
- func (k Keeper) GetTotalCollateral(ctx sdk.Context) sdk.Int
- func (k Keeper) GetTotalShield(ctx sdk.Context) sdk.Int
- func (k Keeper) GetTotalWithdrawing(ctx sdk.Context) sdk.Int
- func (k Keeper) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (stakingtypes.ValidatorI, bool)
- func (k Keeper) GetVotingParams(ctx sdk.Context) govtypes.VotingParams
- func (k Keeper) GetWithdrawQueueTimeSlice(ctx sdk.Context, timestamp time.Time) []types.Withdraw
- func (k Keeper) GetWithdrawsByProvider(ctx sdk.Context, providerAddr string) []types.Withdraw
- func (k Keeper) Hooks() Hooks
- func (k Keeper) InsertExpiringPurchaseQueue(ctx sdk.Context, purchaseList types.PurchaseList, endTime time.Time)
- func (k Keeper) InsertWithdrawQueue(ctx sdk.Context, withdraw types.Withdraw)
- func (k Keeper) IterateAllPools(ctx sdk.Context, callback func(pool types.Pool) (stop bool))
- func (k Keeper) IterateOriginalStakings(ctx sdk.Context, callback func(original types.OriginalStaking) (stop bool))
- func (k Keeper) IteratePoolPurchaseLists(ctx sdk.Context, poolID uint64, ...)
- func (k Keeper) IterateProviders(ctx sdk.Context, callback func(provider types.Provider) (stop bool))
- func (k Keeper) IterateProvidersPaginated(ctx sdk.Context, page, limit uint, cb func(vote types.Provider) (stop bool))
- func (k Keeper) IteratePurchaseListEntries(ctx sdk.Context, callback func(purchase types.Purchase) (stop bool))
- func (k Keeper) IteratePurchaseLists(ctx sdk.Context, callback func(purchase types.PurchaseList) (stop bool))
- func (k Keeper) IterateReimbursements(ctx sdk.Context, callback func(rmb types.Reimbursement) (stop bool))
- func (k Keeper) IterateStakeForShields(ctx sdk.Context, callback func(purchase types.ShieldStaking) (stop bool))
- func (k Keeper) IterateWithdraws(ctx sdk.Context, callback func(withdraw []types.Withdraw) (stop bool))
- func (k Keeper) MakePayoutByProviderDelegations(ctx sdk.Context, providerAddr sdk.AccAddress, purchased, payout sdk.Int) error
- func (k Keeper) PausePool(ctx sdk.Context, updater sdk.AccAddress, id uint64) (types.Pool, error)
- func (k Keeper) PayFromDelegation(ctx sdk.Context, delAddr sdk.AccAddress, payout sdk.Int)
- func (k Keeper) PayFromUnbondings(ctx sdk.Context, ubd stakingtypes.UnbondingDelegation, payout sdk.Int)
- func (k Keeper) PayoutNativeRewards(ctx sdk.Context, addr sdk.AccAddress) (sdk.Coins, error)
- func (q Keeper) Pool(c context.Context, req *types.QueryPoolRequest) (*types.QueryPoolResponse, error)
- func (q Keeper) PoolParams(c context.Context, req *types.QueryPoolParamsRequest) (*types.QueryPoolParamsResponse, error)
- func (q Keeper) PoolPurchaseLists(c context.Context, req *types.QueryPoolPurchaseListsRequest) (*types.QueryPurchaseListsResponse, error)
- func (q Keeper) Pools(c context.Context, req *types.QueryPoolsRequest) (*types.QueryPoolsResponse, error)
- func (k Keeper) ProcessStakeForShieldExpiration(ctx sdk.Context, poolID, purchaseID uint64, bondDenom string, ...) error
- func (q Keeper) Provider(c context.Context, req *types.QueryProviderRequest) (*types.QueryProviderResponse, error)
- func (q Keeper) Providers(c context.Context, req *types.QueryProvidersRequest) (*types.QueryProvidersResponse, error)
- func (q Keeper) PurchaseList(c context.Context, req *types.QueryPurchaseListRequest) (*types.QueryPurchaseListResponse, error)
- func (q Keeper) PurchaseLists(c context.Context, req *types.QueryPurchaseListsRequest) (*types.QueryPurchaseListsResponse, error)
- func (k Keeper) PurchaseShield(ctx sdk.Context, poolID uint64, shield sdk.Coins, description string, ...) (types.Purchase, error)
- func (q Keeper) Purchases(c context.Context, req *types.QueryPurchasesRequest) (*types.QueryPurchasesResponse, error)
- func (q Keeper) Reimbursement(c context.Context, req *types.QueryReimbursementRequest) (*types.QueryReimbursementResponse, error)
- func (q Keeper) Reimbursements(c context.Context, req *types.QueryReimbursementsRequest) (*types.QueryReimbursementsResponse, error)
- func (k Keeper) RemoveDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (k Keeper) RemoveExpiredPurchasesAndDistributeFees(ctx sdk.Context)
- func (k Keeper) RemoveTimeSliceFromWithdrawQueue(ctx sdk.Context, timestamp time.Time)
- func (k Keeper) RestoreShield(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, id uint64, ...) error
- func (k Keeper) ResumePool(ctx sdk.Context, updater sdk.AccAddress, id uint64) (types.Pool, error)
- func (k Keeper) SecureCollaterals(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, purchaseID uint64, ...) error
- func (k Keeper) SecureFromProvider(ctx sdk.Context, provider types.Provider, amount sdk.Int, ...)
- func (k Keeper) SetAdmin(ctx sdk.Context, admin sdk.AccAddress)
- func (k Keeper) SetBlockServiceFees(ctx sdk.Context, serviceFees types.MixedDecCoins)
- func (k Keeper) SetClaimProposalParams(ctx sdk.Context, claimProposalParams types.ClaimProposalParams)
- func (k Keeper) SetDistributionParams(ctx sdk.Context, dp types.DistributionParams)
- func (k Keeper) SetExpiringPurchaseQueueTimeSlice(ctx sdk.Context, timestamp time.Time, ppPairs []types.PoolPurchaser)
- func (k Keeper) SetGlobalShieldStakingPool(ctx sdk.Context, value sdk.Int)
- func (k Keeper) SetLastUpdateTime(ctx sdk.Context, prevUpdateTime time.Time)
- func (k Keeper) SetNextPoolID(ctx sdk.Context, id uint64)
- func (k Keeper) SetNextPurchaseID(ctx sdk.Context, id uint64)
- func (k Keeper) SetOriginalStaking(ctx sdk.Context, purchaseID uint64, amount sdk.Int)
- func (k Keeper) SetPool(ctx sdk.Context, pool types.Pool)
- func (k Keeper) SetPoolParams(ctx sdk.Context, poolParams types.PoolParams)
- func (k Keeper) SetProvider(ctx sdk.Context, delAddr sdk.AccAddress, provider types.Provider)
- func (k Keeper) SetPurchaseList(ctx sdk.Context, purchaseList types.PurchaseList)
- func (k Keeper) SetReimbursement(ctx sdk.Context, proposalID uint64, payout types.Reimbursement)
- func (k Keeper) SetRemainingServiceFees(ctx sdk.Context, serviceFees types.MixedDecCoins)
- func (k Keeper) SetServiceFees(ctx sdk.Context, serviceFees types.MixedDecCoins)
- func (k Keeper) SetShieldStakingRate(ctx sdk.Context, rate sdk.Dec)
- func (k Keeper) SetStakeForShield(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, ...)
- func (k Keeper) SetTotalClaimed(ctx sdk.Context, totalClaimed sdk.Int)
- func (k Keeper) SetTotalCollateral(ctx sdk.Context, totalCollateral sdk.Int)
- func (k Keeper) SetTotalShield(ctx sdk.Context, totalShield sdk.Int)
- func (k Keeper) SetTotalWithdrawing(ctx sdk.Context, totalWithdrawing sdk.Int)
- func (k Keeper) SetWithdrawQueueTimeSlice(ctx sdk.Context, timestamp time.Time, withdraws []types.Withdraw)
- func (q Keeper) ShieldStaking(c context.Context, req *types.QueryShieldStakingRequest) (*types.QueryShieldStakingResponse, error)
- func (q Keeper) ShieldStakingRate(c context.Context, req *types.QueryShieldStakingRateRequest) (*types.QueryShieldStakingRateResponse, error)
- func (q Keeper) ShieldStatus(c context.Context, req *types.QueryShieldStatusRequest) (*types.QueryShieldStatusResponse, error)
- func (q Keeper) Sponsor(c context.Context, req *types.QuerySponsorRequest) (*types.QuerySponsorResponse, error)
- func (k Keeper) UndelegateFromAccountToShieldModule(ctx sdk.Context, senderModule string, delAddr sdk.AccAddress, amt sdk.Coins) error
- func (k Keeper) UndelegateShares(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, ...)
- func (k Keeper) UnstakeFromShield(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, amount sdk.Int) error
- func (k Keeper) UpdateDelegationAmount(ctx sdk.Context, delAddr sdk.AccAddress)
- func (k Keeper) UpdatePool(ctx sdk.Context, poolID uint64, description string, updater sdk.AccAddress, ...) (types.Pool, error)
- func (k Keeper) UpdateProviderCollateralForPayout(ctx sdk.Context, providerAddr sdk.AccAddress, purchased, payout sdk.Int) error
- func (k Keeper) UpdateSponsor(ctx sdk.Context, poolID uint64, newSponsor string, ...) (types.Pool, error)
- func (k Keeper) WithdrawCollateral(ctx sdk.Context, from sdk.AccAddress, amount sdk.Int) error
- func (k Keeper) WithdrawQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (k Keeper) WithdrawReimbursement(ctx sdk.Context, proposalID uint64, beneficiary sdk.AccAddress) (sdk.Coins, error)
- type Migrator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GlobalStakingPoolInvariant ¶
GlobalStakingPoolInvariant checks the total staked sum equals to the global staking pool amount.
func ModuleAccountInvariant ¶
ModuleAccountInvariant checks that the module account coins reflects the sum of remaining services and rewards held on store
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the shield MsgServer interface for the provided Keeper.
func NewQuerier ¶
func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
NewQuerier creates a querier for shield module.
func ProviderInvariant ¶
ProviderInvariant checks that the providers' coin amounts equal to the tracked value.
func RandomDelegation ¶
RandomDelegation returns a random delegation info given access to the keeper and ctx.
func RandomMaturedProposalIDReimbursementPair ¶
func RandomMaturedProposalIDReimbursementPair(r *rand.Rand, k Keeper, ctx sdk.Context) (types.ProposalIDReimbursementPair, bool)
RandomMaturedProposalIDReimbursementPair returns a random proposal ID - reimbursement pair for a matured reimbursement.
func RandomPoolInfo ¶
RandomPoolInfo returns info of a random pool given access to the keeper and ctx.
func RandomProvider ¶
RandomProvider returns a random provider of collaterals.
func RandomPurchaseList ¶
RandomPurchaseList returns a random purchase given access to the keeper and ctx.
func RandomValidator ¶
RandomValidator returns a random validator given access to the keeper and ctx.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers all shield invariants.
func ShieldInvariant ¶
ShieldInvariant checks that the sum of individual pools' shield is equal to the total shield.
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Wrapper struct
func (Hooks) AfterDelegationModified ¶
func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, _ sdk.ValAddress)
- when a delegator delegates - when a delegator sends an unbond tx. before the delegation is moved to unbonding queue - when a validator self-delegates to become a validator - when a delegator sends a redelegate tx
func (Hooks) AfterValidatorBeginUnbonding ¶
func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress)
func (Hooks) AfterValidatorBonded ¶
func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress)
func (Hooks) AfterValidatorCreated ¶
func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
unused hooks
func (Hooks) AfterValidatorRemoved ¶
func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress)
func (Hooks) BeforeDelegationCreated ¶
func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (Hooks) BeforeDelegationRemoved ¶
func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- when a delegator sends an unbond tx that removes a delegation - when a delegator sends a redelegate tx
func (Hooks) BeforeDelegationSharesModified ¶
func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (Hooks) BeforeValidatorModified ¶
func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress)
func (Hooks) BeforeValidatorSlashed ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper implements the shield keeper.
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, shieldStoreKey sdk.StoreKey, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, gk types.GovKeeper, paramSpace types.ParamSubspace) Keeper
NewKeeper creates a shield keeper.
func (Keeper) AddPurchase ¶
func (k Keeper) AddPurchase(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, purchase types.Purchase) types.PurchaseList
AddPurchase sets a purchase of shield.
func (Keeper) AddStaking ¶
func (Keeper) ClaimParams ¶
func (q Keeper) ClaimParams(c context.Context, req *types.QueryClaimParamsRequest) (*types.QueryClaimParamsResponse, error)
ClaimParams queries claim proposal parameters.
func (Keeper) ClosePools ¶
ClosePools closes pools when both of the pool's shield and shield limit is non-positive.
func (Keeper) ComputeTotalUnbondingAmount ¶
func (Keeper) ComputeUnbondingAmountByTime ¶
func (Keeper) ComputeWithdrawAmountByTime ¶
func (k Keeper) ComputeWithdrawAmountByTime(ctx sdk.Context, provider string, time time.Time) sdk.Int
ComputeWithdrawAmountByTime computes the amount of collaterals from a given provider that will be dequeued from the withdraw queue by a given time.
func (Keeper) CreatePool ¶
func (k Keeper) CreatePool(ctx sdk.Context, creator sdk.AccAddress, shield sdk.Coins, serviceFees types.MixedCoins, sponsor string, sponsorAddr sdk.AccAddress, description string, shieldLimit sdk.Int) (uint64, error)
CreatePool creates a pool and sponsor's shield.
func (Keeper) CreateReimbursement ¶
func (k Keeper) CreateReimbursement(ctx sdk.Context, proposalID uint64, amount sdk.Coins, beneficiary sdk.AccAddress) error
CreateReimbursement creates a reimbursement.
func (Keeper) DelayUnbonding ¶
func (Keeper) DelayWithdraws ¶
func (k Keeper) DelayWithdraws(ctx sdk.Context, provider string, amount sdk.Int, delayedTime time.Time) error
DelayWithdraws delays the given amount of withdraws maturing before the delay duration until the end of the delay duration.
func (Keeper) DeleteBlockServiceFees ¶
func (Keeper) DeletePurchaseList ¶
DeletePurchaseList deletes a purchase of shield.
func (Keeper) DeleteReimbursement ¶
DeleteReimbursement deletes a reimbursement.
func (Keeper) DepositCollateral ¶
DepositCollateral deposits a community member's collateral for a pool.
func (Keeper) DequeueCompletedWithdrawQueue ¶
DequeueCompletedWithdrawQueue dequeues completed withdraws and processes their completions.
func (Keeper) DequeuePurchase ¶
func (k Keeper) DequeuePurchase(ctx sdk.Context, purchaseList types.PurchaseList, timestamp time.Time)
DequeuePurchase removes a pool-purchaser pair at a given timestamp of the purchase queue.
func (Keeper) DistrParams ¶ added in v2.4.0
func (q Keeper) DistrParams(c context.Context, req *types.QueryDistrParamsRequest) (*types.QueryDistrParamsResponse, error)
DistrParams queries shield distribution parameters.
func (Keeper) ExpiringPurchaseQueueIterator ¶
ExpiringPurchaseQueueIterator returns a iterator of purchases expiring before endTime
func (Keeper) FundShieldBlockRewards ¶
func (Keeper) GetAdmin ¶
func (k Keeper) GetAdmin(ctx sdk.Context) sdk.AccAddress
GetAdmin gets the Shield admin account address.
func (Keeper) GetAllOriginalStakings ¶
func (k Keeper) GetAllOriginalStakings(ctx sdk.Context) (originalStakings []types.OriginalStaking)
func (Keeper) GetAllPools ¶
GetAllPools retrieves all pools in the store.
func (Keeper) GetAllProposalIDReimbursementPairs ¶
func (k Keeper) GetAllProposalIDReimbursementPairs(ctx sdk.Context) []types.ProposalIDReimbursementPair
GetAllProposalIDReimbursementPairs retrieves all proposal ID and reimbursement pairs.
func (Keeper) GetAllProviders ¶
GetAllProviders retrieves all providers.
func (Keeper) GetAllPurchaseLists ¶
func (k Keeper) GetAllPurchaseLists(ctx sdk.Context) (purchases []types.PurchaseList)
GetAllPurchaseLists retrieves all purchase lists.
func (Keeper) GetAllPurchases ¶
GetAllPurchases retrieves all purchases.
func (Keeper) GetAllReimbursements ¶
func (k Keeper) GetAllReimbursements(ctx sdk.Context) (rmbs []types.Reimbursement)
GetAllReimbursements retrieves all reimbursements.
func (Keeper) GetAllStakeForShields ¶
func (k Keeper) GetAllStakeForShields(ctx sdk.Context) (purchases []types.ShieldStaking)
func (Keeper) GetAllWithdraws ¶
GetAllWithdraws gets all collaterals that are being withdrawn.
func (Keeper) GetBlockServiceFees ¶
func (k Keeper) GetBlockServiceFees(ctx sdk.Context) types.MixedDecCoins
func (Keeper) GetClaimProposalParams ¶
func (k Keeper) GetClaimProposalParams(ctx sdk.Context) types.ClaimProposalParams
GetClaimProposalParams returns shield claim proposal parameters.
func (Keeper) GetDistributionParams ¶ added in v2.4.0
func (k Keeper) GetDistributionParams(ctx sdk.Context) (distrParams types.DistributionParams)
GetDistributionParams returns distribution parameters.
func (Keeper) GetExpiringPurchaseQueueTimeSlice ¶
func (k Keeper) GetExpiringPurchaseQueueTimeSlice(ctx sdk.Context, timestamp time.Time) []types.PoolPurchaser
GetExpiringPurchaseQueueTimeSlice gets a specific purchase queue timeslice, which is a slice of purchases corresponding to a given time.
func (Keeper) GetGlobalShieldStakingPool ¶
func (Keeper) GetLastUpdateTime ¶
GetLastUpdateTime returns the last update time.
func (Keeper) GetNextPoolID ¶
GetNextPoolID gets the latest pool ID from store.
func (Keeper) GetNextPurchaseID ¶
GetNextPurchaseID gets the latest pool ID from store.
func (Keeper) GetOriginalStaking ¶
func (Keeper) GetPoolParams ¶
func (k Keeper) GetPoolParams(ctx sdk.Context) types.PoolParams
GetPoolParams returns shield pool parameters.
func (Keeper) GetPoolPurchaseLists ¶
func (k Keeper) GetPoolPurchaseLists(ctx sdk.Context, poolID uint64) (purchases []types.PurchaseList)
GetPoolPurchaseLists returns all purchases in a given pool.
func (Keeper) GetPoolsBySponsor ¶
GetPoolsBySponsor search store for a pool object with given pool ID.
func (Keeper) GetProvider ¶
func (k Keeper) GetProvider(ctx sdk.Context, delegator sdk.AccAddress) (dt types.Provider, found bool)
GetProvider returns data of a provider given its address.
func (Keeper) GetProvidersIteratorPaginated ¶
GetProvidersIteratorPaginated returns an iterator to go over providers based on pagination parameters.
func (Keeper) GetProvidersPaginated ¶
func (k Keeper) GetProvidersPaginated(ctx sdk.Context, page, limit uint) (providers []types.Provider)
GetProvidersPaginated performs paginated query of providers.
func (Keeper) GetPurchase ¶
func (Keeper) GetPurchase(purchaseList types.PurchaseList, purchaseID uint64) (types.Purchase, bool)
GetPurchase gets a purchase out of a purchase list
func (Keeper) GetPurchaseList ¶
func (k Keeper) GetPurchaseList(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress) (types.PurchaseList, bool)
GetPurchaseList gets a purchase from store by txhash.
func (Keeper) GetPurchaserPurchases ¶
func (k Keeper) GetPurchaserPurchases(ctx sdk.Context, address sdk.AccAddress) (res []types.PurchaseList)
GetPurchaserPurchases returns all purchases by a given purchaser.
func (Keeper) GetReimbursement ¶
GetReimbursement get a reimbursement in store.
func (Keeper) GetRemainingServiceFees ¶
func (k Keeper) GetRemainingServiceFees(ctx sdk.Context) types.MixedDecCoins
func (Keeper) GetServiceFees ¶
func (k Keeper) GetServiceFees(ctx sdk.Context) types.MixedDecCoins
func (Keeper) GetShieldBlockRewardRatio ¶ added in v2.4.0
GetShieldBlockRewardRatio calculates the dynamic ratio for block rewards to shield module, based on total shield and total collateral.
func (Keeper) GetShieldStakingRate ¶
GetShieldStakingRate returns shield to staked rate.
func (Keeper) GetSortedUnbondingDelegations ¶
func (k Keeper) GetSortedUnbondingDelegations(ctx sdk.Context, delAddr sdk.AccAddress) []stakingtypes.UnbondingDelegation
GetSortedUnbondingDelegations gets unbonding delegations sorted by completion time from latest to earliest.
func (Keeper) GetStakeForShield ¶
func (k Keeper) GetStakeForShield(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress) (purchase types.ShieldStaking, found bool)
func (Keeper) GetValidator ¶
func (k Keeper) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (stakingtypes.ValidatorI, bool)
GetValidator returns info of a validator given its operator address.
func (Keeper) GetVotingParams ¶
func (k Keeper) GetVotingParams(ctx sdk.Context) govtypes.VotingParams
GetVotingParams returns gov keeper's voting params.
func (Keeper) GetWithdrawQueueTimeSlice ¶
GetWithdrawQueueTimeSlice gets a specific withdraw queue timeslice, which is a slice of withdraws corresponding to a given time.
func (Keeper) GetWithdrawsByProvider ¶
GetWithdrawsByProvider gets all withdraws of a provider.
func (Keeper) InsertExpiringPurchaseQueue ¶
func (k Keeper) InsertExpiringPurchaseQueue(ctx sdk.Context, purchaseList types.PurchaseList, endTime time.Time)
InsertExpiringPurchaseQueue inserts a purchase into the expired purchase queue.
func (Keeper) InsertWithdrawQueue ¶
InsertWithdrawQueue prepares a withdraw queue timeslice for insertion into the queue.
func (Keeper) IterateAllPools ¶
IterateAllPools iterates over the all the stored pools and performs a callback function.
func (Keeper) IterateOriginalStakings ¶
func (k Keeper) IterateOriginalStakings(ctx sdk.Context, callback func(original types.OriginalStaking) (stop bool))
IterateStakeForShields iterates through purchase lists in a pool
func (Keeper) IteratePoolPurchaseLists ¶
func (k Keeper) IteratePoolPurchaseLists(ctx sdk.Context, poolID uint64, callback func(purchaseList types.PurchaseList) (stop bool))
IteratePoolPurchaseLists iterates through purchases in a pool
func (Keeper) IterateProviders ¶
func (k Keeper) IterateProviders(ctx sdk.Context, callback func(provider types.Provider) (stop bool))
IterateProviders iterates through all providers.
func (Keeper) IterateProvidersPaginated ¶
func (k Keeper) IterateProvidersPaginated(ctx sdk.Context, page, limit uint, cb func(vote types.Provider) (stop bool))
IterateProvidersPaginated iterates over providers based on pagination parameters and performs a callback function.
func (Keeper) IteratePurchaseListEntries ¶
func (k Keeper) IteratePurchaseListEntries(ctx sdk.Context, callback func(purchase types.Purchase) (stop bool))
IteratePurchaseListEntries iterates through entries of all purchase lists.
func (Keeper) IteratePurchaseLists ¶
func (k Keeper) IteratePurchaseLists(ctx sdk.Context, callback func(purchase types.PurchaseList) (stop bool))
IteratePurchaseLists iterates through purchase lists in a pool
func (Keeper) IterateReimbursements ¶
func (k Keeper) IterateReimbursements(ctx sdk.Context, callback func(rmb types.Reimbursement) (stop bool))
IterateReimbursements iterates through all reimbursements.
func (Keeper) IterateStakeForShields ¶
func (k Keeper) IterateStakeForShields(ctx sdk.Context, callback func(purchase types.ShieldStaking) (stop bool))
IterateStakeForShields iterates through purchase lists in a pool
func (Keeper) IterateWithdraws ¶
func (k Keeper) IterateWithdraws(ctx sdk.Context, callback func(withdraw []types.Withdraw) (stop bool))
IterateWithdraws iterates through all ongoing withdraws.
func (Keeper) MakePayoutByProviderDelegations ¶
func (k Keeper) MakePayoutByProviderDelegations(ctx sdk.Context, providerAddr sdk.AccAddress, purchased, payout sdk.Int) error
MakePayoutByProviderDelegations undelegates the provider's delegations and transfers tokens from the staking module account to the shield module account.
func (Keeper) PayFromDelegation ¶
PayFromDelegation reduce provider's delegations and transfer tokens to the shield module account.
func (Keeper) PayFromUnbondings ¶
func (k Keeper) PayFromUnbondings(ctx sdk.Context, ubd stakingtypes.UnbondingDelegation, payout sdk.Int)
PayFromUnbondings reduce provider's unbonding delegations and transfer tokens to the shield module account.
func (Keeper) PayoutNativeRewards ¶
PayoutNativeRewards pays out pending CTK rewards.
func (Keeper) Pool ¶
func (q Keeper) Pool(c context.Context, req *types.QueryPoolRequest) (*types.QueryPoolResponse, error)
Pool queries a pool based on the ID or sponsor.
func (Keeper) PoolParams ¶
func (q Keeper) PoolParams(c context.Context, req *types.QueryPoolParamsRequest) (*types.QueryPoolParamsResponse, error)
PoolParams queries pool parameters.
func (Keeper) PoolPurchaseLists ¶
func (q Keeper) PoolPurchaseLists(c context.Context, req *types.QueryPoolPurchaseListsRequest) (*types.QueryPurchaseListsResponse, error)
PurchaserPurchaseLists queries purchase lists for a given pool.
func (Keeper) Pools ¶
func (q Keeper) Pools(c context.Context, req *types.QueryPoolsRequest) (*types.QueryPoolsResponse, error)
Pools queries all pools.
func (Keeper) ProcessStakeForShieldExpiration ¶
func (Keeper) Provider ¶
func (q Keeper) Provider(c context.Context, req *types.QueryProviderRequest) (*types.QueryProviderResponse, error)
Provider queries a provider given the address.
func (Keeper) Providers ¶
func (q Keeper) Providers(c context.Context, req *types.QueryProvidersRequest) (*types.QueryProvidersResponse, error)
Providers queries all providers.
func (Keeper) PurchaseList ¶
func (q Keeper) PurchaseList(c context.Context, req *types.QueryPurchaseListRequest) (*types.QueryPurchaseListResponse, error)
PurchaseList queries a purchase list given a pool-purchase pair.
func (Keeper) PurchaseLists ¶
func (q Keeper) PurchaseLists(c context.Context, req *types.QueryPurchaseListsRequest) (*types.QueryPurchaseListsResponse, error)
PurchaseLists queries purchase lists purchaser.
func (Keeper) PurchaseShield ¶
func (k Keeper) PurchaseShield(ctx sdk.Context, poolID uint64, shield sdk.Coins, description string, purchaser sdk.AccAddress, staking bool) (types.Purchase, error)
PurchaseShield purchases shield of a pool with standard fee rate.
func (Keeper) Purchases ¶
func (q Keeper) Purchases(c context.Context, req *types.QueryPurchasesRequest) (*types.QueryPurchasesResponse, error)
Purchases queries all purchases.
func (Keeper) Reimbursement ¶
func (q Keeper) Reimbursement(c context.Context, req *types.QueryReimbursementRequest) (*types.QueryReimbursementResponse, error)
Reimbursement queries a reimbursement by proposal ID.
func (Keeper) Reimbursements ¶
func (q Keeper) Reimbursements(c context.Context, req *types.QueryReimbursementsRequest) (*types.QueryReimbursementsResponse, error)
Reimbursements queries all reimbursements.
func (Keeper) RemoveDelegation ¶
func (k Keeper) RemoveDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
RemoveDelegation updates the provider when its delegation is removed.
func (Keeper) RemoveExpiredPurchasesAndDistributeFees ¶
RemoveExpiredPurchasesAndDistributeFees removes expired purchases and distributes fees for current block.
func (Keeper) RemoveTimeSliceFromWithdrawQueue ¶
RemoveTimeSliceFromWithdrawQueue removes a time slice from the withdraw queue.
func (Keeper) RestoreShield ¶
func (k Keeper) RestoreShield(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, id uint64, loss sdk.Coins) error
RestoreShield restores shield-related states as they were prior to the claim proposal submission.
func (Keeper) ResumePool ¶
ResumePool sets an inactive pool to be active.
func (Keeper) SecureCollaterals ¶
func (k Keeper) SecureCollaterals(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, purchaseID uint64, loss sdk.Coins, duration time.Duration) error
SecureCollaterals is called after a claim is submitted to secure the given amount of collaterals for the duration and adjust shield module states accordingly.
func (Keeper) SecureFromProvider ¶
func (k Keeper) SecureFromProvider(ctx sdk.Context, provider types.Provider, amount sdk.Int, duration time.Duration)
SecureFromProvider secures the specified amount of collaterals from the provider for the duration. If necessary, it extends withdrawing collaterals and, if exist, their linked unbondings as well.
func (Keeper) SetAdmin ¶
func (k Keeper) SetAdmin(ctx sdk.Context, admin sdk.AccAddress)
SetAdmin sets the Shield admin account address.
func (Keeper) SetBlockServiceFees ¶
func (k Keeper) SetBlockServiceFees(ctx sdk.Context, serviceFees types.MixedDecCoins)
func (Keeper) SetClaimProposalParams ¶
func (k Keeper) SetClaimProposalParams(ctx sdk.Context, claimProposalParams types.ClaimProposalParams)
SetClaimProposalParams sets parameters subspace for shield claim proposal parameters.
func (Keeper) SetDistributionParams ¶ added in v2.4.0
func (k Keeper) SetDistributionParams(ctx sdk.Context, dp types.DistributionParams)
SetDistributionParams sets distribution parameters.
func (Keeper) SetExpiringPurchaseQueueTimeSlice ¶
func (k Keeper) SetExpiringPurchaseQueueTimeSlice(ctx sdk.Context, timestamp time.Time, ppPairs []types.PoolPurchaser)
SetExpiringPurchaseQueueTimeSlice sets a time slice for a purchase expiring at give time.
func (Keeper) SetGlobalShieldStakingPool ¶
func (Keeper) SetLastUpdateTime ¶
SetLastUpdateTime sets the last update time. Last update time will be set when the first purchase is made or distributing service fees.
func (Keeper) SetNextPoolID ¶
SetLatestPoolID sets the latest pool ID to store.
func (Keeper) SetNextPurchaseID ¶
SetNextPurchaseID sets the latest pool ID to store.
func (Keeper) SetOriginalStaking ¶
func (Keeper) SetPoolParams ¶
func (k Keeper) SetPoolParams(ctx sdk.Context, poolParams types.PoolParams)
SetPoolParams sets parameters subspace for shield pool parameters.
func (Keeper) SetProvider ¶
SetProvider sets data of a provider in the kv-store.
func (Keeper) SetPurchaseList ¶
func (k Keeper) SetPurchaseList(ctx sdk.Context, purchaseList types.PurchaseList)
SetPurchaseList sets a purchase list.
func (Keeper) SetReimbursement ¶
SetReimbursement sets a reimbursement in store.
func (Keeper) SetRemainingServiceFees ¶
func (k Keeper) SetRemainingServiceFees(ctx sdk.Context, serviceFees types.MixedDecCoins)
func (Keeper) SetServiceFees ¶
func (k Keeper) SetServiceFees(ctx sdk.Context, serviceFees types.MixedDecCoins)
func (Keeper) SetShieldStakingRate ¶
SetShieldStakingRate sets shield to staked rate.
func (Keeper) SetStakeForShield ¶
func (k Keeper) SetStakeForShield(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, purchase types.ShieldStaking)
func (Keeper) SetTotalClaimed ¶
func (Keeper) SetTotalCollateral ¶
func (Keeper) SetTotalWithdrawing ¶
func (Keeper) SetWithdrawQueueTimeSlice ¶
func (k Keeper) SetWithdrawQueueTimeSlice(ctx sdk.Context, timestamp time.Time, withdraws []types.Withdraw)
SetWithdrawQueueTimeSlice stores a withdraw queue timeslice using the timestamp as the key.
func (Keeper) ShieldStaking ¶
func (q Keeper) ShieldStaking(c context.Context, req *types.QueryShieldStakingRequest) (*types.QueryShieldStakingResponse, error)
ShieldStaking queries staked-for-shield for pool-purchaser pair.
func (Keeper) ShieldStakingRate ¶
func (q Keeper) ShieldStakingRate(c context.Context, req *types.QueryShieldStakingRateRequest) (*types.QueryShieldStakingRateResponse, error)
ShieldStakingRate queries the shield staking rate for shield.
func (Keeper) ShieldStatus ¶
func (q Keeper) ShieldStatus(c context.Context, req *types.QueryShieldStatusRequest) (*types.QueryShieldStatusResponse, error)
ShieldStatus queries the global status of the shield module.
func (Keeper) Sponsor ¶
func (q Keeper) Sponsor(c context.Context, req *types.QuerySponsorRequest) (*types.QuerySponsorResponse, error)
Pool queries a pool based on the ID or sponsor.
func (Keeper) UndelegateFromAccountToShieldModule ¶
func (k Keeper) UndelegateFromAccountToShieldModule(ctx sdk.Context, senderModule string, delAddr sdk.AccAddress, amt sdk.Coins) error
UndelegateFromAccountToShieldModule performs undelegations from a delegator's staking to the shield module.
func (Keeper) UndelegateShares ¶
func (k Keeper) UndelegateShares(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares sdk.Dec)
UndelegateShares undelegates delegations of a delegator to a validator by shares.
func (Keeper) UnstakeFromShield ¶
func (Keeper) UpdateDelegationAmount ¶
func (k Keeper) UpdateDelegationAmount(ctx sdk.Context, delAddr sdk.AccAddress)
UpdateDelegationAmount updates the provider based on tha changes of its delegations.
func (Keeper) UpdatePool ¶
func (k Keeper) UpdatePool(ctx sdk.Context, poolID uint64, description string, updater sdk.AccAddress, shield sdk.Coins, serviceFees types.MixedCoins, shieldLimit sdk.Int) (types.Pool, error)
UpdatePool updates pool info and shield for B.
func (Keeper) UpdateProviderCollateralForPayout ¶
func (k Keeper) UpdateProviderCollateralForPayout(ctx sdk.Context, providerAddr sdk.AccAddress, purchased, payout sdk.Int) error
UpdateProviderCollateralForPayout updates a provider's collateral and withdraws according to the payout.
func (Keeper) UpdateSponsor ¶
func (k Keeper) UpdateSponsor(ctx sdk.Context, poolID uint64, newSponsor string, newSponsorAddr, updater sdk.AccAddress) (types.Pool, error)
UpdateSponsor updates the sponsor information of a given pool.
func (Keeper) WithdrawCollateral ¶
WithdrawCollateral withdraws a community member's collateral for a pool. In case of unbonding-initiated withdraw, store the validator address and the creation height.
func (Keeper) WithdrawQueueIterator ¶
WithdrawQueueIterator returns all the withdraw queue timeslices from time 0 until endTime.
type Migrator ¶ added in v2.4.0
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func NewMigrator ¶ added in v2.4.0
NewMigrator returns a new Migrator.