repository

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalculatedVolume

type CalculatedVolume struct {
	HeightStart uint64
	HeightEnd   uint64
	PoolId      uint64
	Volume      types.Coins
	Value       []float64
}

type MissingPool

type MissingPool struct {
	Height uint64
	PoolId uint64
}

type Pool

type Pool struct {
	Timestamp time.Time
	Height    uint64
	PoolId    uint64
	Liquidity types.Coins
	Volume    types.Coins
}

type Repository

type Repository interface {
	// IBCDenom will return a denom mapped from IBC denom
	IBCDenom(ibcDenom string) (IBCTypes.DenomTrace, bool)
	// IBCDenomAll will return all ibc trace denoms
	IBCDenomAll() []IBCTypes.DenomTrace
	// TokenPrice will return token price record at a fiven timestamp
	TokenPrice(timestamp time.Time, denom string) (TokenPrice, bool)
	// NearestTokenPrice will return:
	//
	//   - Same as TokenPrice if the denom exists at specified timestamp
	//   - Nearest token price from timestamp < specified timestamp
	//   - Nearest token price from timestamp > specified timestamp
	NearestTokenPrice(timestamp time.Time, denom string) ([]TokenPrice, bool)
	// LatestTokenPrice will return latest token price
	LatestTokenPrice(denom string) (TokenPrice, bool)
	// LatestPool will return latest pool
	LatestPool(id uint64) (Pool, bool)

	// PoolsRange will return a list of available pools from minimum to maximum heights
	PoolsRange(minHeight, maxHeight, poolId uint64) ([]Pool, error)

	// TokenPriceRange will return stored token prices between and including min/max timestamps
	TokenPricesRange(min, max time.Time, denom string) ([]TokenPrice, error)

	SaveIBCDenom(IBCTypes.DenomTrace) error
	SaveTokenPrice(TokenPrice) error
	SavePool(Pool) error

	// PruneTokenPrices will remove all token prices prior timestamp.
	PruneTokenPrices(timestamp time.Time) (int, error)
	// PrunePools will remove all pools prior block height.
	PrunePools(height uint64) (int, error)
}

type TokenPrice

type TokenPrice struct {
	LastUpdated time.Time
	Value       float64
	Name        string
	Base        string
}

Jump to

Keyboard shortcuts

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