keeper

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GlobalStakingPoolInvariant

func GlobalStakingPoolInvariant(keeper Keeper) sdk.Invariant

GlobalStakingPoolInvariant checks the total staked sum equals to the global staking pool amount.

func ModuleAccountInvariant

func ModuleAccountInvariant(keeper Keeper) sdk.Invariant

ModuleAccountInvariant checks that the module account coins reflects the sum of remaining services and rewards held on store

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func ProviderInvariant(keeper Keeper) sdk.Invariant

ProviderInvariant checks that the providers' coin amounts equal to the tracked value.

func RandomDelegation

func RandomDelegation(r *rand.Rand, k Keeper, ctx sdk.Context) (sdk.AccAddress, sdk.Int, bool)

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

func RandomPoolInfo(r *rand.Rand, k Keeper, ctx sdk.Context) (uint64, string, bool)

RandomPoolInfo returns info of a random pool given access to the keeper and ctx.

func RandomProvider

func RandomProvider(r *rand.Rand, k Keeper, ctx sdk.Context) (types.Provider, bool)

RandomProvider returns a random provider of collaterals.

func RandomPurchaseList

func RandomPurchaseList(r *rand.Rand, k Keeper, ctx sdk.Context) (types.PurchaseList, bool)

RandomPurchaseList returns a random purchase given access to the keeper and ctx.

func RandomValidator

func RandomValidator(r *rand.Rand, k Keeper, ctx sdk.Context) (staking.Validator, bool)

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

func ShieldInvariant(keeper Keeper) sdk.Invariant

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

func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)

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 (k Keeper) AddStaking(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, purchaseID uint64, stakingAmt sdk.Int) error

func (Keeper) BondDenom

func (k Keeper) BondDenom(ctx sdk.Context) string

BondDenom returns staking bond denomination.

func (Keeper) ClaimEnd

func (k Keeper) ClaimEnd(ctx sdk.Context, id, poolID uint64, loss sdk.Coins)

ClaimEnd ends a claim process by updating the total claimed amount.

func (Keeper) ClaimParams

ClaimParams queries claim proposal parameters.

func (Keeper) ClosePool

func (k Keeper) ClosePool(ctx sdk.Context, pool types.Pool)

ClosePool closes the pool.

func (Keeper) ClosePools

func (k Keeper) ClosePools(ctx sdk.Context)

ClosePools closes pools when both of the pool's shield and shield limit is non-positive.

func (Keeper) ComputeTotalUnbondingAmount

func (k Keeper) ComputeTotalUnbondingAmount(ctx sdk.Context, provider sdk.AccAddress) sdk.Int

func (Keeper) ComputeUnbondingAmountByTime

func (k Keeper) ComputeUnbondingAmountByTime(ctx sdk.Context, provider sdk.AccAddress, time time.Time) sdk.Int

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 (k Keeper) DelayUnbonding(ctx sdk.Context, provider sdk.AccAddress, amount sdk.Int, delayedTime time.Time) error

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 (k Keeper) DeleteBlockServiceFees(ctx sdk.Context)

func (Keeper) DeletePurchaseList

func (k Keeper) DeletePurchaseList(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress) error

DeletePurchaseList deletes a purchase of shield.

func (Keeper) DeleteReimbursement

func (k Keeper) DeleteReimbursement(ctx sdk.Context, proposalID uint64) error

DeleteReimbursement deletes a reimbursement.

func (Keeper) DepositCollateral

func (k Keeper) DepositCollateral(ctx sdk.Context, from sdk.AccAddress, amount sdk.Int) error

DepositCollateral deposits a community member's collateral for a pool.

func (Keeper) DequeueCompletedWithdrawQueue

func (k Keeper) DequeueCompletedWithdrawQueue(ctx sdk.Context)

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

DistrParams queries shield distribution parameters.

func (Keeper) ExpiringPurchaseQueueIterator

func (k Keeper) ExpiringPurchaseQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

ExpiringPurchaseQueueIterator returns a iterator of purchases expiring before endTime

func (Keeper) FundShieldBlockRewards

func (k Keeper) FundShieldBlockRewards(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error

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

func (k Keeper) GetAllPools(ctx sdk.Context) (pools []types.Pool)

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

func (k Keeper) GetAllProviders(ctx sdk.Context) (providers []types.Provider)

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

func (k Keeper) GetAllPurchases(ctx sdk.Context) (purchases []types.Purchase)

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

func (k Keeper) GetAllWithdraws(ctx sdk.Context) (result []types.Withdraw)

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 (k Keeper) GetGlobalShieldStakingPool(ctx sdk.Context) (pool sdk.Int)

func (Keeper) GetLastUpdateTime

func (k Keeper) GetLastUpdateTime(ctx sdk.Context) (time.Time, bool)

GetLastUpdateTime returns the last update time.

func (Keeper) GetNextPoolID

func (k Keeper) GetNextPoolID(ctx sdk.Context) uint64

GetNextPoolID gets the latest pool ID from store.

func (Keeper) GetNextPurchaseID

func (k Keeper) GetNextPurchaseID(ctx sdk.Context) uint64

GetNextPurchaseID gets the latest pool ID from store.

func (Keeper) GetOriginalStaking

func (k Keeper) GetOriginalStaking(ctx sdk.Context, purchaseID uint64) sdk.Int

func (Keeper) GetPool

func (k Keeper) GetPool(ctx sdk.Context, id uint64) (types.Pool, bool)

GetPool gets data of a pool given pool ID.

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

func (k Keeper) GetPoolsBySponsor(ctx sdk.Context, sponsorAddr string) ([]types.Pool, bool)

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

func (k Keeper) GetProvidersIteratorPaginated(ctx sdk.Context, page, limit uint) sdk.Iterator

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

func (k Keeper) GetReimbursement(ctx sdk.Context, proposalID uint64) (types.Reimbursement, error)

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

func (k Keeper) GetShieldBlockRewardRatio(ctx sdk.Context) sdk.Dec

GetShieldBlockRewardRatio calculates the dynamic ratio for block rewards to shield module, based on total shield and total collateral.

func (Keeper) GetShieldStakingRate

func (k Keeper) GetShieldStakingRate(ctx sdk.Context) (rate sdk.Dec)

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) GetTotalClaimed

func (k Keeper) GetTotalClaimed(ctx sdk.Context) sdk.Int

func (Keeper) GetTotalCollateral

func (k Keeper) GetTotalCollateral(ctx sdk.Context) sdk.Int

func (Keeper) GetTotalShield

func (k Keeper) GetTotalShield(ctx sdk.Context) sdk.Int

func (Keeper) GetTotalWithdrawing

func (k Keeper) GetTotalWithdrawing(ctx sdk.Context) sdk.Int

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

func (k Keeper) GetWithdrawQueueTimeSlice(ctx sdk.Context, timestamp time.Time) []types.Withdraw

GetWithdrawQueueTimeSlice gets a specific withdraw queue timeslice, which is a slice of withdraws corresponding to a given time.

func (Keeper) GetWithdrawsByProvider

func (k Keeper) GetWithdrawsByProvider(ctx sdk.Context, providerAddr string) []types.Withdraw

GetWithdrawsByProvider gets all withdraws of a provider.

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Create new distribution hooks

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

func (k Keeper) InsertWithdrawQueue(ctx sdk.Context, withdraw types.Withdraw)

InsertWithdrawQueue prepares a withdraw queue timeslice for insertion into the queue.

func (Keeper) IterateAllPools

func (k Keeper) IterateAllPools(ctx sdk.Context, callback func(pool types.Pool) (stop bool))

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) PausePool

func (k Keeper) PausePool(ctx sdk.Context, updater sdk.AccAddress, id uint64) (types.Pool, error)

PausePool sets an active pool to be inactive.

func (Keeper) PayFromDelegation

func (k Keeper) PayFromDelegation(ctx sdk.Context, delAddr sdk.AccAddress, payout sdk.Int)

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

func (k Keeper) PayoutNativeRewards(ctx sdk.Context, addr sdk.AccAddress) (sdk.Coins, error)

PayoutNativeRewards pays out pending CTK rewards.

func (Keeper) Pool

Pool queries a pool based on the ID or sponsor.

func (Keeper) PoolParams

PoolParams queries pool parameters.

func (Keeper) PoolPurchaseLists

PurchaserPurchaseLists queries purchase lists for a given pool.

func (Keeper) Pools

Pools queries all pools.

func (Keeper) ProcessStakeForShieldExpiration

func (k Keeper) ProcessStakeForShieldExpiration(ctx sdk.Context, poolID, purchaseID uint64, bondDenom string, purchaser sdk.AccAddress) error

func (Keeper) Provider

Provider queries a provider given the address.

func (Keeper) Providers

Providers queries all providers.

func (Keeper) PurchaseList

PurchaseList queries a purchase list given a pool-purchase pair.

func (Keeper) PurchaseLists

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

Purchases queries all purchases.

func (Keeper) Reimbursement

Reimbursement queries a reimbursement by proposal ID.

func (Keeper) Reimbursements

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

func (k Keeper) RemoveExpiredPurchasesAndDistributeFees(ctx sdk.Context)

RemoveExpiredPurchasesAndDistributeFees removes expired purchases and distributes fees for current block.

func (Keeper) RemoveTimeSliceFromWithdrawQueue

func (k Keeper) RemoveTimeSliceFromWithdrawQueue(ctx sdk.Context, timestamp time.Time)

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

func (k Keeper) ResumePool(ctx sdk.Context, updater sdk.AccAddress, id uint64) (types.Pool, error)

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 (k Keeper) SetGlobalShieldStakingPool(ctx sdk.Context, value sdk.Int)

func (Keeper) SetLastUpdateTime

func (k Keeper) SetLastUpdateTime(ctx sdk.Context, prevUpdateTime time.Time)

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

func (k Keeper) SetNextPoolID(ctx sdk.Context, id uint64)

SetLatestPoolID sets the latest pool ID to store.

func (Keeper) SetNextPurchaseID

func (k Keeper) SetNextPurchaseID(ctx sdk.Context, id uint64)

SetNextPurchaseID sets the latest pool ID to store.

func (Keeper) SetOriginalStaking

func (k Keeper) SetOriginalStaking(ctx sdk.Context, purchaseID uint64, amount sdk.Int)

func (Keeper) SetPool

func (k Keeper) SetPool(ctx sdk.Context, pool types.Pool)

SetPool sets data of a pool in kv-store.

func (Keeper) SetPoolParams

func (k Keeper) SetPoolParams(ctx sdk.Context, poolParams types.PoolParams)

SetPoolParams sets parameters subspace for shield pool parameters.

func (Keeper) SetProvider

func (k Keeper) SetProvider(ctx sdk.Context, delAddr sdk.AccAddress, provider types.Provider)

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

func (k Keeper) SetReimbursement(ctx sdk.Context, proposalID uint64, payout types.Reimbursement)

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

func (k Keeper) SetShieldStakingRate(ctx sdk.Context, rate sdk.Dec)

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 (k Keeper) SetTotalClaimed(ctx sdk.Context, totalClaimed sdk.Int)

func (Keeper) SetTotalCollateral

func (k Keeper) SetTotalCollateral(ctx sdk.Context, totalCollateral sdk.Int)

func (Keeper) SetTotalShield

func (k Keeper) SetTotalShield(ctx sdk.Context, totalShield sdk.Int)

func (Keeper) SetTotalWithdrawing

func (k Keeper) SetTotalWithdrawing(ctx sdk.Context, totalWithdrawing sdk.Int)

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

ShieldStaking queries staked-for-shield for pool-purchaser pair.

func (Keeper) ShieldStakingRate

ShieldStakingRate queries the shield staking rate for shield.

func (Keeper) ShieldStatus

ShieldStatus queries the global status of the shield module.

func (Keeper) Sponsor

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 (k Keeper) UnstakeFromShield(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, amount sdk.Int) error

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

func (k Keeper) WithdrawCollateral(ctx sdk.Context, from sdk.AccAddress, amount sdk.Int) error

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

func (k Keeper) WithdrawQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

WithdrawQueueIterator returns all the withdraw queue timeslices from time 0 until endTime.

func (Keeper) WithdrawReimbursement

func (k Keeper) WithdrawReimbursement(ctx sdk.Context, proposalID uint64, beneficiary sdk.AccAddress) (sdk.Coins, error)

WithdrawReimbursement withdraws a reimbursement made for a beneficiary.

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

func NewMigrator(keeper Keeper, queryServer grpc.Server) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2 added in v2.4.0

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2.

Jump to

Keyboard shortcuts

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