Documentation ¶
Index ¶
- Variables
- type Keeper
- func (k Keeper) ConcentratedLiquidityListener() concentratedliquiditytypes.ConcentratedLiquidityListener
- func (k Keeper) DeleteHistoricalRecord(ctx sdk.Context, twap types.TwapRecord)
- func (k Keeper) DeleteHistoricalTimeIndexedTWAPs(ctx sdk.Context)
- func (k Keeper) DeleteMostRecentRecord(ctx sdk.Context, twap types.TwapRecord)
- func (k Keeper) EndBlock(ctx sdk.Context)
- func (k Keeper) EpochHooks() epochtypes.EpochHooks
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GammHooks() gammtypes.GammHooks
- func (k Keeper) GetAllHistoricalPoolIndexedTWAPsForPoolId(ctx sdk.Context, poolId uint64) ([]types.TwapRecord, error)
- func (k Keeper) GetAllMostRecentRecordsForPool(ctx sdk.Context, poolId uint64) ([]types.TwapRecord, error)
- func (k Keeper) GetAllMostRecentRecordsForPoolWithDenoms(ctx sdk.Context, poolId uint64, denoms []string) ([]types.TwapRecord, error)
- func (k Keeper) GetArithmeticStrategy() *arithmetic
- func (k Keeper) GetArithmeticTwap(ctx sdk.Context, poolId uint64, baseAssetDenom string, quoteAssetDenom string, ...) (osmomath.Dec, error)
- func (k Keeper) GetArithmeticTwapToNow(ctx sdk.Context, poolId uint64, baseAssetDenom string, quoteAssetDenom string, ...) (osmomath.Dec, error)
- func (k Keeper) GetBeginBlockAccumulatorRecord(ctx sdk.Context, poolId uint64, asset0Denom string, asset1Denom string) (types.TwapRecord, error)
- func (k Keeper) GetGeometricStrategy() *geometric
- func (k Keeper) GetGeometricTwap(ctx sdk.Context, poolId uint64, baseAssetDenom string, quoteAssetDenom string, ...) (osmomath.Dec, error)
- func (k Keeper) GetGeometricTwapToNow(ctx sdk.Context, poolId uint64, baseAssetDenom string, quoteAssetDenom string, ...) (osmomath.Dec, error)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPruningState(ctx sdk.Context) types.PruningState
- func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState)
- func (k Keeper) IsDeprecatedHistoricalTWAPsPruning(ctx sdk.Context) bool
- func (k *Keeper) PruneEpochIdentifier(ctx sdk.Context) string
- func (k *Keeper) RecordHistoryKeepPeriod(ctx sdk.Context) time.Duration
- func (k Keeper) SetDeprecatedHistoricalTWAPsIsPruning(ctx sdk.Context)
- func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{})
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPruningState(ctx sdk.Context, state types.PruningState)
- func (k Keeper) StoreHistoricalTWAP(ctx sdk.Context, twap types.TwapRecord)
- func (k Keeper) StoreNewRecord(ctx sdk.Context, twap types.TwapRecord)
Constants ¶
This section is empty.
Variables ¶
var NumDeprecatedRecordsToPrunePerBlock uint16 = 200
NumDeprecatedRecordsToPrunePerBlock is the number of twap records indexed by time to prune per block. This is the same as NumRecordsToPrunePerBlock, but is used for the deprecated historical twap records. This is to be used in the upgrade handler, to clear out the now-obsolete historical twap records that were indexed by time. It is expected that these records will be pruned shortly after the upgrade. After all these records are pruned, this logic can be removed for a future upgrade.
var NumRecordsToPrunePerBlock uint16 = 200
NumRecordsToPrunePerBlock is the number of twap records indexed by pool ID to prune per block. One record indexed by pool ID is deleted per incentive record. Therefore, setting this to 200 means 200 complete incentive records are deleted per block. The choice is somewhat arbitrary However, th intuition is that the number should be low enough to not make blocks take longer but not too small where it would take all the way to the next epoch.
Functions ¶
This section is empty.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper(storeKey storetypes.StoreKey, transientKey *storetypes.TransientStoreKey, paramSpace paramtypes.Subspace, poolmanagerKeeper types.PoolManagerInterface) *Keeper
func (Keeper) ConcentratedLiquidityListener ¶
func (k Keeper) ConcentratedLiquidityListener() concentratedliquiditytypes.ConcentratedLiquidityListener
func (Keeper) DeleteHistoricalRecord ¶
func (k Keeper) DeleteHistoricalRecord(ctx sdk.Context, twap types.TwapRecord)
func (Keeper) DeleteHistoricalTimeIndexedTWAPs ¶
DeleteHistoricalTimeIndexedTWAPs deletes every historical twap record indexed by time (now deprecated) up till the limit. This is to be used in the upgrade handler, to clear out the now-obsolete historical twap records that were indexed by time.
func (Keeper) DeleteMostRecentRecord ¶
func (k Keeper) DeleteMostRecentRecord(ctx sdk.Context, twap types.TwapRecord)
DeleteMostRecentRecord deletes a given record in most recent record store. Note that if there are entries in historical indexes for this record, they are not deleted by this method.
func (Keeper) EpochHooks ¶
func (k Keeper) EpochHooks() epochtypes.EpochHooks
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the twap module's exported genesis.
func (Keeper) GetAllHistoricalPoolIndexedTWAPsForPoolId ¶
func (k Keeper) GetAllHistoricalPoolIndexedTWAPsForPoolId(ctx sdk.Context, poolId uint64) ([]types.TwapRecord, error)
GetAllHistoricalPoolIndexedTWAPsForPoolId returns HistoricalTwapRecord for a pool give poolId.
func (Keeper) GetAllMostRecentRecordsForPool ¶
func (k Keeper) GetAllMostRecentRecordsForPool(ctx sdk.Context, poolId uint64) ([]types.TwapRecord, error)
GetAllMostRecentRecordsForPool returns all most recent twap records (in state representation) for the provided pool id.
func (Keeper) GetAllMostRecentRecordsForPoolWithDenoms ¶
func (k Keeper) GetAllMostRecentRecordsForPoolWithDenoms(ctx sdk.Context, poolId uint64, denoms []string) ([]types.TwapRecord, error)
GetAllMostRecentRecordsForPool returns all most recent twap records (in state representation) for the provided pool id.
func (Keeper) GetArithmeticStrategy ¶
func (k Keeper) GetArithmeticStrategy() *arithmetic
GetArithmeticStrategy gets arithmetic TWAP keeper.
func (Keeper) GetArithmeticTwap ¶
func (k Keeper) GetArithmeticTwap( ctx sdk.Context, poolId uint64, baseAssetDenom string, quoteAssetDenom string, startTime time.Time, endTime time.Time, ) (osmomath.Dec, error)
N.B. If there is a notable use case, the state machine could maintain more historical records, e.g. at one per hour.
func (Keeper) GetArithmeticTwapToNow ¶
func (k Keeper) GetArithmeticTwapToNow( ctx sdk.Context, poolId uint64, baseAssetDenom string, quoteAssetDenom string, startTime time.Time, ) (osmomath.Dec, error)
GetArithmeticTwapToNow returns arithmetic twap from start time until the current block time for quote and base assets in a given pool.
func (Keeper) GetBeginBlockAccumulatorRecord ¶
func (k Keeper) GetBeginBlockAccumulatorRecord(ctx sdk.Context, poolId uint64, asset0Denom string, asset1Denom string) (types.TwapRecord, error)
GetBeginBlockAccumulatorRecord returns a TwapRecord struct corresponding to the state of pool `poolId` as of the beginning of the block this is called on.
func (Keeper) GetGeometricStrategy ¶
func (k Keeper) GetGeometricStrategy() *geometric
GetGeometricStrategy gets geometric TWAP keeper.
func (Keeper) GetGeometricTwap ¶
func (Keeper) GetGeometricTwapToNow ¶
func (Keeper) GetPruningState ¶
func (k Keeper) GetPruningState(ctx sdk.Context) types.PruningState
GetPruningState gets the current pruning state, which is used to determine whether to prune historical records in the EndBlock. This allows us to spread out the computational cost of pruning over time rather than all at once at epoch.
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState)
InitGenesis initializes the twap module's state from a provided genesis state.
func (Keeper) IsDeprecatedHistoricalTWAPsPruning ¶
IsDeprecatedHistoricalTWAPsPruning returns whether the deprecated historical twaps are being pruned.
func (*Keeper) RecordHistoryKeepPeriod ¶
func (Keeper) SetDeprecatedHistoricalTWAPsIsPruning ¶
SetDeprecatedHistoricalTWAPsIsPruning sets the state entry that determines if we are still executing pruning logic in the end blocker.
func (Keeper) SetParam ¶
SetParam sets a specific twap module's parameter with the provided parameter.
func (Keeper) SetPruningState ¶
func (k Keeper) SetPruningState(ctx sdk.Context, state types.PruningState)
func (Keeper) StoreHistoricalTWAP ¶
func (k Keeper) StoreHistoricalTWAP(ctx sdk.Context, twap types.TwapRecord)
storeHistoricalTWAP writes a twap to the store, indexed by pool id.
func (Keeper) StoreNewRecord ¶
func (k Keeper) StoreNewRecord(ctx sdk.Context, twap types.TwapRecord)
StoreNewRecord stores a record, in both the most recent record store and historical stores.
Directories ¶
Path | Synopsis |
---|---|
queryproto
Package queryproto is a reverse proxy.
|
Package queryproto is a reverse proxy. |