Documentation ¶
Index ¶
- Variables
- func AccumulationStoreInvariant(keeper Keeper) sdk.Invariant
- func LocksBalancesInvariant(keeper Keeper) sdk.Invariant
- func MergeLockupsForSimilarDurations(ctx sdk.Context, k Keeper, ak types.AccountKeeper, ...)
- func NewMsgServerImpl(keeper *Keeper) types.MsgServer
- func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)
- func SyntheticLockupInvariant(keeper Keeper) sdk.Invariant
- type AdminKeeper
- type Keeper
- func (k Keeper) AccountLockIterator(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress) sdk.Iterator
- func (k Keeper) AccountLockIteratorAfterTime(ctx sdk.Context, addr sdk.AccAddress, time time.Time) sdk.Iterator
- func (k Keeper) AccountLockIteratorAfterTimeDenom(ctx sdk.Context, addr sdk.AccAddress, denom string, time time.Time) sdk.Iterator
- func (k Keeper) AccountLockIteratorBeforeTime(ctx sdk.Context, addr sdk.AccAddress, time time.Time) sdk.Iterator
- func (k Keeper) AccountLockIteratorBeforeTimeDenom(ctx sdk.Context, addr sdk.AccAddress, denom string, time time.Time) sdk.Iterator
- func (k Keeper) AccountLockIteratorDenom(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress, denom string) sdk.Iterator
- func (k Keeper) AccountLockIteratorDuration(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress, duration time.Duration) sdk.Iterator
- func (k Keeper) AccountLockIteratorDurationDenom(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress, denom string, ...) sdk.Iterator
- func (k Keeper) AccountLockIteratorLongerDuration(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress, duration time.Duration) sdk.Iterator
- func (k Keeper) AccountLockIteratorLongerDurationDenom(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress, denom string, ...) sdk.Iterator
- func (k Keeper) AccountLockIteratorShorterThanDuration(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress, duration time.Duration) sdk.Iterator
- func (k Keeper) AddToExistingLock(ctx sdk.Context, owner sdk.AccAddress, coin sdk.Coin, duration time.Duration) (uint64, error)
- func (k Keeper) AddTokensToLockByID(ctx sdk.Context, lockID uint64, owner sdk.AccAddress, tokensToAdd sdk.Coin) (*types.PeriodLock, error)
- func (k Keeper) BeginForceUnlock(ctx sdk.Context, lockID uint64, coins sdk.Coins) (uint64, error)
- func (k Keeper) BeginForceUnlockWithEndTime(ctx sdk.Context, lockID uint64, endTime time.Time) error
- func (k Keeper) BeginUnlock(ctx sdk.Context, lockID uint64, coins sdk.Coins) (uint64, error)
- func (k Keeper) BeginUnlockAllNotUnlockings(ctx sdk.Context, account sdk.AccAddress) ([]types.PeriodLock, error)
- func (k Keeper) ClearAccumulationStores(ctx sdk.Context)
- func (k Keeper) CreateLock(ctx sdk.Context, owner sdk.AccAddress, coins sdk.Coins, duration time.Duration) (types.PeriodLock, error)
- func (k Keeper) CreateLockNoSend(ctx sdk.Context, owner sdk.AccAddress, coins sdk.Coins, duration time.Duration) (types.PeriodLock, error)
- func (k Keeper) CreateSyntheticLockup(ctx sdk.Context, lockID uint64, synthDenom string, ...) error
- func (k Keeper) DeleteAllMaturedSyntheticLocks(ctx sdk.Context)
- func (k Keeper) DeleteSyntheticLockup(ctx sdk.Context, lockID uint64, synthdenom string) error
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) ExtendLockup(ctx sdk.Context, lockID uint64, owner sdk.AccAddress, ...) error
- func (k Keeper) ForceUnlock(ctx sdk.Context, lock types.PeriodLock) error
- func (k Keeper) GetAccountLockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (k Keeper) GetAccountLockedDuration(ctx sdk.Context, addr sdk.AccAddress, duration time.Duration) []types.PeriodLock
- func (k Keeper) GetAccountLockedDurationNotUnlockingOnly(ctx sdk.Context, addr sdk.AccAddress, denom string, duration time.Duration) []types.PeriodLock
- func (k Keeper) GetAccountLockedLongerDuration(ctx sdk.Context, addr sdk.AccAddress, duration time.Duration) []types.PeriodLock
- func (k Keeper) GetAccountLockedLongerDurationDenom(ctx sdk.Context, addr sdk.AccAddress, denom string, duration time.Duration) []types.PeriodLock
- func (k Keeper) GetAccountLockedLongerDurationDenomNotUnlockingOnly(ctx sdk.Context, addr sdk.AccAddress, denom string, duration time.Duration) []types.PeriodLock
- func (k Keeper) GetAccountLockedLongerDurationNotUnlockingOnly(ctx sdk.Context, addr sdk.AccAddress, duration time.Duration) []types.PeriodLock
- func (k Keeper) GetAccountLockedPastTime(ctx sdk.Context, addr sdk.AccAddress, timestamp time.Time) []types.PeriodLock
- func (k Keeper) GetAccountLockedPastTimeDenom(ctx sdk.Context, addr sdk.AccAddress, denom string, timestamp time.Time) []types.PeriodLock
- func (k Keeper) GetAccountLockedPastTimeNotUnlockingOnly(ctx sdk.Context, addr sdk.AccAddress, timestamp time.Time) []types.PeriodLock
- func (k Keeper) GetAccountPeriodLocks(ctx sdk.Context, addr sdk.AccAddress) []types.PeriodLock
- func (k Keeper) GetAccountUnlockableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (k Keeper) GetAccountUnlockedBeforeTime(ctx sdk.Context, addr sdk.AccAddress, timestamp time.Time) []types.PeriodLock
- func (k Keeper) GetAccountUnlockingCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (k Keeper) GetAllSyntheticLockups(ctx sdk.Context) []types.SyntheticLock
- func (k Keeper) GetAllSyntheticLockupsByAddr(ctx sdk.Context, owner sdk.AccAddress) []types.SyntheticLock
- func (k Keeper) GetForceUnlockAllowedAddresses(ctx sdk.Context) (forceUnlockAllowedAddresses []string)
- func (k Keeper) GetLastLockID(ctx sdk.Context) uint64
- func (k Keeper) GetLockByID(ctx sdk.Context, lockID uint64) (*types.PeriodLock, error)
- func (k Keeper) GetLockRewardReceiver(ctx sdk.Context, lockID uint64) (string, error)
- func (k Keeper) GetLockedDenom(ctx sdk.Context, denom string, duration time.Duration) osmomath.Int
- func (k Keeper) GetLocksDenom(ctx sdk.Context, denom string) []types.PeriodLock
- func (k Keeper) GetLocksLongerThanDurationDenom(ctx sdk.Context, denom string, duration time.Duration) []types.PeriodLock
- func (k Keeper) GetLocksPastTimeDenom(ctx sdk.Context, denom string, timestamp time.Time) []types.PeriodLock
- func (k Keeper) GetModuleBalance(ctx sdk.Context) sdk.Coins
- func (k Keeper) GetModuleLockedCoins(ctx sdk.Context) sdk.Coins
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPeriodLocks(ctx sdk.Context) ([]types.PeriodLock, error)
- func (k Keeper) GetPeriodLocksAccumulation(ctx sdk.Context, query types.QueryCondition) osmomath.Int
- func (k Keeper) GetSyntheticLockup(ctx sdk.Context, lockID uint64, synthdenom string) (*types.SyntheticLock, error)
- func (k Keeper) GetSyntheticLockupByUnderlyingLockId(ctx sdk.Context, lockID uint64) (types.SyntheticLock, bool, error)
- func (k Keeper) GetUnderlyingLock(ctx sdk.Context, synthlock types.SyntheticLock) types.PeriodLock
- func (k Keeper) HasAnySyntheticLockups(ctx sdk.Context, lockID uint64) bool
- func (k Keeper) HasLock(ctx sdk.Context, owner sdk.AccAddress, denom string, duration time.Duration) bool
- func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
- func (k Keeper) InitializeAllLocks(ctx sdk.Context, locks []types.PeriodLock) error
- func (k Keeper) InitializeAllSyntheticLocks(ctx sdk.Context, syntheticLocks []types.SyntheticLock) error
- func (k Keeper) LockIterator(ctx sdk.Context, isUnlocking bool) sdk.Iterator
- func (k Keeper) LockIteratorAfterTime(ctx sdk.Context, time time.Time) sdk.Iterator
- func (k Keeper) LockIteratorAfterTimeDenom(ctx sdk.Context, denom string, time time.Time) sdk.Iterator
- func (k Keeper) LockIteratorBeforeTime(ctx sdk.Context, time time.Time) sdk.Iterator
- func (k Keeper) LockIteratorBeforeTimeDenom(ctx sdk.Context, denom string, time time.Time) sdk.Iterator
- func (k Keeper) LockIteratorDenom(ctx sdk.Context, isUnlocking bool, denom string) sdk.Iterator
- func (k Keeper) LockIteratorLongerThanDurationDenom(ctx sdk.Context, isUnlocking bool, denom string, duration time.Duration) sdk.Iterator
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) PartialForceUnlock(ctx sdk.Context, lock types.PeriodLock, coins sdk.Coins) error
- func (k Keeper) RebuildAccumulationStoreForDenom(ctx sdk.Context, denom string)
- func (k Keeper) RebuildSuperfluidAccumulationStoresForDenom(ctx sdk.Context, denom string)
- func (k *Keeper) SetHooks(lh types.LockupHooks) *Keeper
- func (k Keeper) SetLastLockID(ctx sdk.Context, ID uint64)
- func (k Keeper) SetLockRewardReceiverAddress(ctx sdk.Context, lockID uint64, owner sdk.AccAddress, ...) error
- func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{})
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SlashTokensFromLockByID(ctx sdk.Context, lockID uint64, coins sdk.Coins) (*types.PeriodLock, error)
- func (k Keeper) SlashTokensFromLockByIDSendUnderlyingAndBurn(ctx sdk.Context, lockID uint64, ...) (*types.PeriodLock, error)
- func (k Keeper) SplitLock(ctx sdk.Context, lock types.PeriodLock, coins sdk.Coins, forceUnlock bool) (types.PeriodLock, error)
- func (k Keeper) UnlockMaturedLock(ctx sdk.Context, lockID uint64) error
- func (k Keeper) WithdrawAllMaturedLocks(ctx sdk.Context)
- type Querier
- func (q Querier) AccountLockedCoins(goCtx context.Context, req *types.AccountLockedCoinsRequest) (*types.AccountLockedCoinsResponse, error)
- func (q Querier) AccountLockedDuration(goCtx context.Context, req *types.AccountLockedDurationRequest) (*types.AccountLockedDurationResponse, error)
- func (q Querier) AccountLockedLongerDuration(goCtx context.Context, req *types.AccountLockedLongerDurationRequest) (*types.AccountLockedLongerDurationResponse, error)
- func (q Querier) AccountLockedLongerDurationDenom(goCtx context.Context, req *types.AccountLockedLongerDurationDenomRequest) (*types.AccountLockedLongerDurationDenomResponse, error)
- func (q Querier) AccountLockedLongerDurationNotUnlockingOnly(goCtx context.Context, ...) (*types.AccountLockedLongerDurationNotUnlockingOnlyResponse, error)
- func (q Querier) AccountLockedPastTime(goCtx context.Context, req *types.AccountLockedPastTimeRequest) (*types.AccountLockedPastTimeResponse, error)
- func (q Querier) AccountLockedPastTimeDenom(goCtx context.Context, req *types.AccountLockedPastTimeDenomRequest) (*types.AccountLockedPastTimeDenomResponse, error)
- func (q Querier) AccountLockedPastTimeNotUnlockingOnly(goCtx context.Context, req *types.AccountLockedPastTimeNotUnlockingOnlyRequest) (*types.AccountLockedPastTimeNotUnlockingOnlyResponse, error)
- func (q Querier) AccountUnlockableCoins(goCtx context.Context, req *types.AccountUnlockableCoinsRequest) (*types.AccountUnlockableCoinsResponse, error)
- func (q Querier) AccountUnlockedBeforeTime(goCtx context.Context, req *types.AccountUnlockedBeforeTimeRequest) (*types.AccountUnlockedBeforeTimeResponse, error)
- func (q Querier) AccountUnlockingCoins(goCtx context.Context, req *types.AccountUnlockingCoinsRequest) (*types.AccountUnlockingCoinsResponse, error)
- func (q Querier) LockRewardReceiver(goCtx context.Context, req *types.LockRewardReceiverRequest) (*types.LockRewardReceiverResponse, error)
- func (q Querier) LockedByID(goCtx context.Context, req *types.LockedRequest) (*types.LockedResponse, error)
- func (q Querier) LockedDenom(goCtx context.Context, req *types.LockedDenomRequest) (*types.LockedDenomResponse, error)
- func (q Querier) ModuleBalance(goCtx context.Context, _ *types.ModuleBalanceRequest) (*types.ModuleBalanceResponse, error)
- func (q Querier) ModuleLockedAmount(goCtx context.Context, _ *types.ModuleLockedAmountRequest) (*types.ModuleLockedAmountResponse, error)
- func (q Querier) NextLockID(goCtx context.Context, req *types.NextLockIDRequest) (*types.NextLockIDResponse, error)
- func (q Querier) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (q Querier) SyntheticLockupByLockupID(goCtx context.Context, req *types.SyntheticLockupByLockupIDRequest) (*types.SyntheticLockupByLockupIDResponse, error)
- func (q Querier) SyntheticLockupsByLockupID(goCtx context.Context, req *types.SyntheticLockupsByLockupIDRequest) (*types.SyntheticLockupsByLockupIDResponse, error)
Constants ¶
This section is empty.
Variables ¶
var (
HourDuration, _ = time.ParseDuration("1h")
DayDuration, _ = time.ParseDuration("24h")
WeekDuration, _ = time.ParseDuration("168h")
TwoWeekDuration, _ = time.ParseDuration("336h")
BaselineDurations = []time.Duration{DayDuration, WeekDuration, TwoWeekDuration}
)
Functions ¶
func AccumulationStoreInvariant ¶
AccumulationStoreInvariant ensures that the sum of all lockups at a given duration is equal to the value stored within the accumulation store.
func LocksBalancesInvariant ¶
LocksBalancesInvariant ensure that the module balance and the sum of all tokens within all locks have the equivalent amount of tokens.
func MergeLockupsForSimilarDurations ¶
func MergeLockupsForSimilarDurations( ctx sdk.Context, k Keeper, ak types.AccountKeeper, baselineDurations []time.Duration, durationDiff time.Duration, )
MergeLockupsForSimilarDurations iterates through every account. For each account, it combines all lockups it has at a similar duration (to be defined in a bit). It will delete every existing lockup for that account, and make at most, a single new lockup per "base duration", denom pair. If a lockup is far from any base duration, we don't change anything about it. We define a lockup length as a "Similar duration to base duration D", if: D <= lockup length <= D + durationDiff. Any locks with different reward receiver and lock owner would not be merged. NOTE: This method has been outdated, please make new migration code if there is a need to merge locks with similar duration.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an instance of MsgServer.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)
RegisterInvariants registers all governance invariants.
func SyntheticLockupInvariant ¶
SyntheticLockupInvariant ensures that synthetic lock's underlying lock id and the actual lock's id has the same id.
Types ¶
type AdminKeeper ¶
type AdminKeeper struct {
Keeper
}
AdminKeeper defines a god privilege keeper functions to remove tokens from locks and create new locks For the governance system of token pools, we want a "ragequit" feature So governance changes will take 1 week to go into effect During that time, people can choose to "ragequit" which means they would leave the original pool and form a new pool with the old parameters but if they still had 2 months of lockup left, their liquidity still needs to be 2 month lockup-ed, just in the new pool And we need to replace their pool1 LP tokens with pool2 LP tokens with the same lock duration and end time.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper provides a way to manage module storage.
func NewKeeper ¶
func NewKeeper(storeKey storetypes.StoreKey, ak types.AccountKeeper, bk types.BankKeeper, ck types.CommunityPoolKeeper, paramSpace paramtypes.Subspace) *Keeper
NewKeeper returns an instance of Keeper.
func (Keeper) AccountLockIterator ¶
func (k Keeper) AccountLockIterator(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress) sdk.Iterator
AccountLockIterator returns the iterator used for getting all locks by account.
func (Keeper) AccountLockIteratorAfterTime ¶
func (k Keeper) AccountLockIteratorAfterTime(ctx sdk.Context, addr sdk.AccAddress, time time.Time) sdk.Iterator
AccountLockIteratorAfterTime returns the iterator to get locked coins by account.
func (Keeper) AccountLockIteratorAfterTimeDenom ¶
func (k Keeper) AccountLockIteratorAfterTimeDenom(ctx sdk.Context, addr sdk.AccAddress, denom string, time time.Time) sdk.Iterator
AccountLockIteratorAfterTimeDenom returns the iterator to get locked coins by account and denom.
func (Keeper) AccountLockIteratorBeforeTime ¶
func (k Keeper) AccountLockIteratorBeforeTime(ctx sdk.Context, addr sdk.AccAddress, time time.Time) sdk.Iterator
AccountLockIteratorBeforeTime returns the iterator to get unlockable coins by account.
func (Keeper) AccountLockIteratorBeforeTimeDenom ¶
func (k Keeper) AccountLockIteratorBeforeTimeDenom(ctx sdk.Context, addr sdk.AccAddress, denom string, time time.Time) sdk.Iterator
AccountLockIteratorBeforeTimeDenom returns the iterator to get unlockable coins by account and denom.
func (Keeper) AccountLockIteratorDenom ¶
func (k Keeper) AccountLockIteratorDenom(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress, denom string) sdk.Iterator
AccountLockIteratorDenom returns the iterator used for getting all locks by account and denom.
func (Keeper) AccountLockIteratorDuration ¶
func (k Keeper) AccountLockIteratorDuration(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress, duration time.Duration) sdk.Iterator
AccountLockIteratorDuration returns an iterator used for getting all locks for a given account, isUnlocking, and specific duration.
func (Keeper) AccountLockIteratorDurationDenom ¶
func (k Keeper) AccountLockIteratorDurationDenom(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress, denom string, duration time.Duration) sdk.Iterator
AccountLockIteratorDurationDenom returns iterator used for getting all locks by account and denom with specific duration.
func (Keeper) AccountLockIteratorLongerDuration ¶
func (k Keeper) AccountLockIteratorLongerDuration(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress, duration time.Duration) sdk.Iterator
AccountLockIteratorLongerDuration returns iterator used for getting all locks by account longer than duration.
func (Keeper) AccountLockIteratorLongerDurationDenom ¶
func (k Keeper) AccountLockIteratorLongerDurationDenom(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress, denom string, duration time.Duration) sdk.Iterator
AccountLockIteratorLongerDurationDenom returns iterator used for getting all locks by account and denom longer than duration.
func (Keeper) AccountLockIteratorShorterThanDuration ¶
func (k Keeper) AccountLockIteratorShorterThanDuration(ctx sdk.Context, isUnlocking bool, addr sdk.AccAddress, duration time.Duration) sdk.Iterator
AccountLockIteratorShorterThanDuration returns an iterator used for getting all locks by account shorter than the specified duration.
func (Keeper) AddToExistingLock ¶
func (k Keeper) AddToExistingLock(ctx sdk.Context, owner sdk.AccAddress, coin sdk.Coin, duration time.Duration) (uint64, error)
AddToExistingLock adds the given coin to the existing lock with the same owner and duration. Returns the updated lock ID if successfully added coin, returns 0 and error when a lock with given condition does not exist, or if fails to add to lock.
func (Keeper) AddTokensToLockByID ¶
func (k Keeper) AddTokensToLockByID(ctx sdk.Context, lockID uint64, owner sdk.AccAddress, tokensToAdd sdk.Coin) (*types.PeriodLock, error)
AddTokensToLock locks additional tokens into an existing lock with the given ID. Tokens locked are sent and kept in the module account. This method alters the lock state in store, thus we do a sanity check to ensure lock owner matches the given owner.
func (Keeper) BeginForceUnlock ¶
BeginForceUnlock begins force unlock of the given lock. This method should be called by the superfluid module ONLY, as it does not check whether the lock has a synthetic lock or not before unlocking. Returns lock id, new lock id if the lock was split, else same lock id.
func (Keeper) BeginForceUnlockWithEndTime ¶
func (Keeper) BeginUnlock ¶
BeginUnlock is a utility to start unlocking coins from NotUnlocking queue. Returns an error if the lock has a synthetic lock.
func (Keeper) BeginUnlockAllNotUnlockings ¶
func (k Keeper) BeginUnlockAllNotUnlockings(ctx sdk.Context, account sdk.AccAddress) ([]types.PeriodLock, error)
BeginUnlockAllNotUnlockings begins unlock for all not unlocking locks of the given account.
func (Keeper) ClearAccumulationStores ¶
func (Keeper) CreateLock ¶
func (k Keeper) CreateLock(ctx sdk.Context, owner sdk.AccAddress, coins sdk.Coins, duration time.Duration) (types.PeriodLock, error)
CreateLock creates a new lock with the specified duration for the owner. Returns an error in the following conditions:
- account does not have enough balance
func (Keeper) CreateLockNoSend ¶
func (k Keeper) CreateLockNoSend(ctx sdk.Context, owner sdk.AccAddress, coins sdk.Coins, duration time.Duration) (types.PeriodLock, error)
CreateLockNoSend behaves the same as CreateLock, but does not send the coins to the lockup module account. This method is used in the concentrated liquidity module since we mint coins directly to the lockup module account. We do not want to mint the coins to send to the user just to send them back to the lockup module account for two reasons:
- it is gas inefficient
- users should not be able to have cl shares in their account, so this is an extra safety measure
func (Keeper) CreateSyntheticLockup ¶
func (k Keeper) CreateSyntheticLockup(ctx sdk.Context, lockID uint64, synthDenom string, unlockDuration time.Duration, isUnlocking bool) error
CreateSyntheticLockup create synthetic lockup with lock id and synthdenom.
func (Keeper) DeleteAllMaturedSyntheticLocks ¶
DeleteAllMaturedSyntheticLocks deletes all matured synthetic locks.
func (Keeper) DeleteSyntheticLockup ¶
DeleteSyntheticLockup delete synthetic lockup with lock id and synthdenom. Synthetic lock has three relevant state entries. - synthetic lock object itself - synthetic lock refs - accumulation store for the synthetic lock. all of which are deleted within this method.
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the capability module's exported genesis.
func (Keeper) ExtendLockup ¶
func (k Keeper) ExtendLockup(ctx sdk.Context, lockID uint64, owner sdk.AccAddress, newDuration time.Duration) error
ExtendLockup changes the existing lock duration to the given lock duration. Updating lock duration would fail on either of the following conditions. 1. Only lock owner is able to change the duration of the lock. 2. Locks that are unlokcing are not allowed to change duration. 3. Locks that have synthetic lockup are not allowed to change. 4. Provided duration should be greater than the original duration.
func (Keeper) ForceUnlock ¶
ForceUnlock ignores unlock duration and immediately unlocks the lock and refunds tokens to lock owner.
func (Keeper) GetAccountLockedCoins ¶
GetAccountLockedCoins Returns a locked coins that can't be withdrawn.
func (Keeper) GetAccountLockedDuration ¶
func (k Keeper) GetAccountLockedDuration(ctx sdk.Context, addr sdk.AccAddress, duration time.Duration) []types.PeriodLock
GetAccountLockedDuration returns locks with a specific duration for a given account.
func (Keeper) GetAccountLockedDurationNotUnlockingOnly ¶
func (k Keeper) GetAccountLockedDurationNotUnlockingOnly(ctx sdk.Context, addr sdk.AccAddress, denom string, duration time.Duration) []types.PeriodLock
GetAccountLockedDurationNotUnlockingOnly Returns account locked with specific duration within not unlockings.
func (Keeper) GetAccountLockedLongerDuration ¶
func (k Keeper) GetAccountLockedLongerDuration(ctx sdk.Context, addr sdk.AccAddress, duration time.Duration) []types.PeriodLock
GetAccountLockedLongerDuration Returns account locked with duration longer than specified.
func (Keeper) GetAccountLockedLongerDurationDenom ¶
func (k Keeper) GetAccountLockedLongerDurationDenom(ctx sdk.Context, addr sdk.AccAddress, denom string, duration time.Duration) []types.PeriodLock
GetAccountLockedLongerDurationDenom Returns account locked with duration longer than specified with specific denom.
func (Keeper) GetAccountLockedLongerDurationDenomNotUnlockingOnly ¶
func (k Keeper) GetAccountLockedLongerDurationDenomNotUnlockingOnly(ctx sdk.Context, addr sdk.AccAddress, denom string, duration time.Duration) []types.PeriodLock
GetAccountLockedLongerDurationDenom Returns account locked with duration longer than specified with specific denom.
func (Keeper) GetAccountLockedLongerDurationNotUnlockingOnly ¶
func (k Keeper) GetAccountLockedLongerDurationNotUnlockingOnly(ctx sdk.Context, addr sdk.AccAddress, duration time.Duration) []types.PeriodLock
GetAccountLockedLongerDurationNotUnlockingOnly Returns account locked with duration longer than specified
func (Keeper) GetAccountLockedPastTime ¶
func (k Keeper) GetAccountLockedPastTime(ctx sdk.Context, addr sdk.AccAddress, timestamp time.Time) []types.PeriodLock
GetAccountLockedPastTime Returns the total locks of an account whose unlock time is beyond timestamp.
func (Keeper) GetAccountLockedPastTimeDenom ¶
func (k Keeper) GetAccountLockedPastTimeDenom(ctx sdk.Context, addr sdk.AccAddress, denom string, timestamp time.Time) []types.PeriodLock
GetAccountLockedPastTimeDenom is equal to GetAccountLockedPastTime but denom specific.
func (Keeper) GetAccountLockedPastTimeNotUnlockingOnly ¶
func (k Keeper) GetAccountLockedPastTimeNotUnlockingOnly(ctx sdk.Context, addr sdk.AccAddress, timestamp time.Time) []types.PeriodLock
GetAccountLockedPastTimeNotUnlockingOnly Returns the total locks of an account whose unlock time is beyond timestamp.
func (Keeper) GetAccountPeriodLocks ¶
func (k Keeper) GetAccountPeriodLocks(ctx sdk.Context, addr sdk.AccAddress) []types.PeriodLock
GetAccountPeriodLocks Returns the period locks associated to an account.
func (Keeper) GetAccountUnlockableCoins ¶
GetAccountUnlockableCoins Returns whole unlockable coins which are not withdrawn yet.
func (Keeper) GetAccountUnlockedBeforeTime ¶
func (k Keeper) GetAccountUnlockedBeforeTime(ctx sdk.Context, addr sdk.AccAddress, timestamp time.Time) []types.PeriodLock
GetAccountUnlockedBeforeTime Returns the total unlocks of an account whose unlock time is before timestamp.
func (Keeper) GetAccountUnlockingCoins ¶
GetAccountUnlockingCoins Returns whole unlocking coins.
func (Keeper) GetAllSyntheticLockups ¶
func (k Keeper) GetAllSyntheticLockups(ctx sdk.Context) []types.SyntheticLock
GetAllSyntheticLockups gets all synthetic locks within the store.
func (Keeper) GetAllSyntheticLockupsByAddr ¶
func (k Keeper) GetAllSyntheticLockupsByAddr(ctx sdk.Context, owner sdk.AccAddress) []types.SyntheticLock
GetAllSyntheticLockupsByAddr gets all the synthetic lockups from all the locks owned by the given address.
func (Keeper) GetForceUnlockAllowedAddresses ¶
func (Keeper) GetLastLockID ¶
GetLastLockID returns ID used last time.
func (Keeper) GetLockByID ¶
GetLockByID Returns lock from lockID.
func (Keeper) GetLockRewardReceiver ¶
GetLockRewardReceiver returns the reward receiver stored in state. Note that if the lock reward receiver address in state is an empty string literal, it indicates that the lock reward receiver is the owner of the lock, thus returns the lock owner address.
func (Keeper) GetLockedDenom ¶
GetLockedDenom Returns the total amount of denom that are locked.
func (Keeper) GetLocksDenom ¶
func (Keeper) GetLocksLongerThanDurationDenom ¶
func (k Keeper) GetLocksLongerThanDurationDenom(ctx sdk.Context, denom string, duration time.Duration) []types.PeriodLock
GetLocksLongerThanDurationDenom Returns the locks whose unlock duration is longer than duration.
func (Keeper) GetLocksPastTimeDenom ¶
func (k Keeper) GetLocksPastTimeDenom(ctx sdk.Context, denom string, timestamp time.Time) []types.PeriodLock
GetLocksPastTimeDenom Returns the locks whose unlock time is beyond timestamp.
func (Keeper) GetModuleBalance ¶
GetModuleBalance returns full balance of the module.
func (Keeper) GetModuleLockedCoins ¶
GetModuleLockedCoins Returns locked balance of the module.
func (Keeper) GetPeriodLocks ¶
GetPeriodLocks Returns the period locks on pool.
func (Keeper) GetPeriodLocksAccumulation ¶
func (k Keeper) GetPeriodLocksAccumulation(ctx sdk.Context, query types.QueryCondition) osmomath.Int
GetPeriodLocksByDuration returns the total amount of query.Denom tokens locked for longer than query.Duration.
func (Keeper) GetSyntheticLockup ¶
func (k Keeper) GetSyntheticLockup(ctx sdk.Context, lockID uint64, synthdenom string) (*types.SyntheticLock, error)
GetSyntheticLockup gets the synthetic lock object using lock ID and synthetic denom as key.
func (Keeper) GetSyntheticLockupByUnderlyingLockId ¶
func (k Keeper) GetSyntheticLockupByUnderlyingLockId(ctx sdk.Context, lockID uint64) (types.SyntheticLock, bool, error)
Error is returned if: - there are more than one synthetic lockup objects with the same underlying lock ID. - there is no synthetic lockup object with the given underlying lock ID. Returns (syntheticLockup, found, error) intended behavior for most callers is to check: if !found || err != nil { handle_it }
func (Keeper) GetUnderlyingLock ¶
func (k Keeper) GetUnderlyingLock(ctx sdk.Context, synthlock types.SyntheticLock) types.PeriodLock
func (Keeper) HasAnySyntheticLockups ¶
HasAnySyntheticLockups returns true if the lock has a synthetic lock.
func (Keeper) HasLock ¶
func (k Keeper) HasLock(ctx sdk.Context, owner sdk.AccAddress, denom string, duration time.Duration) bool
HasLock returns true if lock with the given condition exists
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
InitGenesis initializes the capability module's state from a provided genesis state.
func (Keeper) InitializeAllLocks ¶
InitializeAllLocks takes a set of locks, and initializes state to be storing them all correctly. This utilizes batch optimizations to improve efficiency, as this becomes a bottleneck at chain initialization & upgrades.
func (Keeper) InitializeAllSyntheticLocks ¶
func (Keeper) LockIterator ¶
LockIterator returns the iterator used for getting all locks.
func (Keeper) LockIteratorAfterTime ¶
LockIteratorAfterTime returns the iterator to get locked coins.
func (Keeper) LockIteratorAfterTimeDenom ¶
func (k Keeper) LockIteratorAfterTimeDenom(ctx sdk.Context, denom string, time time.Time) sdk.Iterator
LockIteratorAfterTimeDenom returns the iterator to get locked coins by denom.
func (Keeper) LockIteratorBeforeTime ¶
LockIteratorBeforeTime returns the iterator to get unlockable coins.
func (Keeper) LockIteratorBeforeTimeDenom ¶
func (k Keeper) LockIteratorBeforeTimeDenom(ctx sdk.Context, denom string, time time.Time) sdk.Iterator
LockIteratorBeforeTimeDenom returns the iterator to get unlockable coins by denom.
func (Keeper) LockIteratorDenom ¶
LockIteratorDenom returns the iterator used for getting all locks by denom.
func (Keeper) LockIteratorLongerThanDurationDenom ¶
func (k Keeper) LockIteratorLongerThanDurationDenom(ctx sdk.Context, isUnlocking bool, denom string, duration time.Duration) sdk.Iterator
LockIteratorLongerThanDurationDenom returns the iterator to get locked locks by denom.
func (Keeper) PartialForceUnlock ¶
PartialForceUnlock begins partial ForceUnlock of given lock for the given amount of coins. ForceUnlocks the lock as a whole when provided coins are empty, or coin provided equals amount of coins in the lock. This also supports the case of lock in an unbonding status.
func (Keeper) RebuildAccumulationStoreForDenom ¶
func (Keeper) RebuildSuperfluidAccumulationStoresForDenom ¶
func (*Keeper) SetHooks ¶
func (k *Keeper) SetHooks(lh types.LockupHooks) *Keeper
Set the lockup hooks.
func (Keeper) SetLastLockID ¶
SetLastLockID save ID used by last lock.
func (Keeper) SetLockRewardReceiverAddress ¶
func (k Keeper) SetLockRewardReceiverAddress(ctx sdk.Context, lockID uint64, owner sdk.AccAddress, newReceiverAddress string) error
SetLockRewardReceiverAddress changes the reward recipient address to the given address. Storing an empty string for reward receiver would indicate the owner being reward receiver.
func (Keeper) SetParam ¶
SetParam sets a specific lockup module's parameter with the provided parameter.
func (Keeper) SlashTokensFromLockByID ¶
func (k Keeper) SlashTokensFromLockByID(ctx sdk.Context, lockID uint64, coins sdk.Coins) (*types.PeriodLock, error)
SlashTokensFromLockByID sends slashed tokens directly from the lock to the community pool. Called by the superfluid module ONLY.
func (Keeper) SlashTokensFromLockByIDSendUnderlyingAndBurn ¶
func (k Keeper) SlashTokensFromLockByIDSendUnderlyingAndBurn(ctx sdk.Context, lockID uint64, liquiditySharesToSlash, underlyingPositionAssets sdk.Coins, poolAddress sdk.AccAddress) (*types.PeriodLock, error)
SlashTokensFromLockByIDSendUnderlyingAndBurn performs the same logic as SlashTokensFromLockByID, but 1. Sends the underlying tokens from the pool address to the community pool (instead of sending the liquidity shares from the module account to the community pool) 2. Burns the liquidity shares from the module account (instead of sending them to the community pool)
func (Keeper) SplitLock ¶
func (k Keeper) SplitLock(ctx sdk.Context, lock types.PeriodLock, coins sdk.Coins, forceUnlock bool) (types.PeriodLock, error)
SplitLock splits a lock with the given amount, and stores split new lock to the state. Returns the new lock after modifying the state of the old lock.
func (Keeper) UnlockMaturedLock ¶
UnlockMaturedLock finishes unlocking by sending back the locked tokens from the module accounts to the owner. This method requires lock to be matured, having passed the endtime of the lock.
func (Keeper) WithdrawAllMaturedLocks ¶
WithdrawAllMaturedLocks withdraws every lock that's in the process of unlocking, and has finished unlocking by the current block time.
type Querier ¶
type Querier struct {
Keeper
}
Querier defines a wrapper around the x/lockup keeper providing gRPC method handlers.
func NewQuerier ¶
func (Querier) AccountLockedCoins ¶
func (q Querier) AccountLockedCoins(goCtx context.Context, req *types.AccountLockedCoinsRequest) (*types.AccountLockedCoinsResponse, error)
AccountLockedCoins returns the total amount of locked coins that can't be withdrawn for a specific account.
func (Querier) AccountLockedDuration ¶
func (q Querier) AccountLockedDuration(goCtx context.Context, req *types.AccountLockedDurationRequest) (*types.AccountLockedDurationResponse, error)
AccountLockedDuration returns the account locked with the specified duration.
func (Querier) AccountLockedLongerDuration ¶
func (q Querier) AccountLockedLongerDuration(goCtx context.Context, req *types.AccountLockedLongerDurationRequest) (*types.AccountLockedLongerDurationResponse, error)
AccountLockedLongerDuration returns locks of an account with duration longer than specified.
func (Querier) AccountLockedLongerDurationDenom ¶
func (q Querier) AccountLockedLongerDurationDenom(goCtx context.Context, req *types.AccountLockedLongerDurationDenomRequest) (*types.AccountLockedLongerDurationDenomResponse, error)
AccountLockedLongerDurationDenom returns locks of an account with duration longer than specified with specific denom.
func (Querier) AccountLockedLongerDurationNotUnlockingOnly ¶
func (q Querier) AccountLockedLongerDurationNotUnlockingOnly(goCtx context.Context, req *types.AccountLockedLongerDurationNotUnlockingOnlyRequest) (*types.AccountLockedLongerDurationNotUnlockingOnlyResponse, error)
AccountLockedLongerDurationNotUnlockingOnly returns locks of an account with longer duration than the specified duration, excluding tokens that has started unlocking.
func (Querier) AccountLockedPastTime ¶
func (q Querier) AccountLockedPastTime(goCtx context.Context, req *types.AccountLockedPastTimeRequest) (*types.AccountLockedPastTimeResponse, error)
AccountLockedPastTime returns the locks of an account whose unlock time is beyond provided timestamp.
func (Querier) AccountLockedPastTimeDenom ¶
func (q Querier) AccountLockedPastTimeDenom(goCtx context.Context, req *types.AccountLockedPastTimeDenomRequest) (*types.AccountLockedPastTimeDenomResponse, error)
AccountLockedPastTimeDenom returns the locks of an account whose unlock time is beyond provided timestamp, limited to locks with the specified denom. Equivalent to `AccountLockedPastTime` but denom specific.
func (Querier) AccountLockedPastTimeNotUnlockingOnly ¶
func (q Querier) AccountLockedPastTimeNotUnlockingOnly(goCtx context.Context, req *types.AccountLockedPastTimeNotUnlockingOnlyRequest) (*types.AccountLockedPastTimeNotUnlockingOnlyResponse, error)
AccountLockedPastTimeNotUnlockingOnly returns locks of an account with unlock time beyond given timestamp excluding locks that has started unlocking.
func (Querier) AccountUnlockableCoins ¶
func (q Querier) AccountUnlockableCoins(goCtx context.Context, req *types.AccountUnlockableCoinsRequest) (*types.AccountUnlockableCoinsResponse, error)
AccountUnlockableCoins returns unlockable coins which are not withdrawn yet.
func (Querier) AccountUnlockedBeforeTime ¶
func (q Querier) AccountUnlockedBeforeTime(goCtx context.Context, req *types.AccountUnlockedBeforeTimeRequest) (*types.AccountUnlockedBeforeTimeResponse, error)
AccountUnlockedBeforeTime returns locks of an account of which unlock time is before the provided timestamp.
func (Querier) AccountUnlockingCoins ¶
func (q Querier) AccountUnlockingCoins(goCtx context.Context, req *types.AccountUnlockingCoinsRequest) (*types.AccountUnlockingCoinsResponse, error)
AccountUnlockingCoins returns the total amount of unlocking coins for a specific account.
func (Querier) LockRewardReceiver ¶
func (q Querier) LockRewardReceiver(goCtx context.Context, req *types.LockRewardReceiverRequest) (*types.LockRewardReceiverResponse, error)
LockRewardReceiver returns lock reward receiver of the lock.
func (Querier) LockedByID ¶
func (q Querier) LockedByID(goCtx context.Context, req *types.LockedRequest) (*types.LockedResponse, error)
LockedByID returns lock by lock ID.
func (Querier) LockedDenom ¶
func (q Querier) LockedDenom(goCtx context.Context, req *types.LockedDenomRequest) (*types.LockedDenomResponse, error)
LockedDenom returns the total amount of denom locked throughout all locks.
func (Querier) ModuleBalance ¶
func (q Querier) ModuleBalance(goCtx context.Context, _ *types.ModuleBalanceRequest) (*types.ModuleBalanceResponse, error)
ModuleBalance Return full balance of the module.
func (Querier) ModuleLockedAmount ¶
func (q Querier) ModuleLockedAmount(goCtx context.Context, _ *types.ModuleLockedAmountRequest) (*types.ModuleLockedAmountResponse, error)
ModuleLockedAmount returns locked balance of the module, which are all the tokens not unlocking + tokens that are not finished unlocking.
func (Querier) NextLockID ¶
func (q Querier) NextLockID(goCtx context.Context, req *types.NextLockIDRequest) (*types.NextLockIDResponse, error)
NextLockID returns next lock ID to be created.
func (Querier) Params ¶
func (q Querier) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params returns module params
func (Querier) SyntheticLockupByLockupID ¶
func (q Querier) SyntheticLockupByLockupID(goCtx context.Context, req *types.SyntheticLockupByLockupIDRequest) (*types.SyntheticLockupByLockupIDResponse, error)
SyntheticLockupByLockupID returns synthetic lockup by native lockup id.
func (Querier) SyntheticLockupsByLockupID ¶
func (q Querier) SyntheticLockupsByLockupID(goCtx context.Context, req *types.SyntheticLockupsByLockupIDRequest) (*types.SyntheticLockupsByLockupIDResponse, error)
SyntheticLockupsByLockupID returns synthetic lockups by native lockup id. Deprecated: use SyntheticLockupByLockupID instead. nolint: staticcheck