repository

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IBCDenom

type IBCDenom struct {
	CreatedAt time.Time
	UpdatedAt time.Time
	IBC       string `gorm:"index:idx_ibc,unique"`
	Path      string
	BaseDenom string
}

type Pool

type Pool struct {
	CreatedAt time.Time
	UpdatedAt time.Time
	Timestamp time.Time
	Height    uint64 `gorm:"index:idx_pool_id,unique"`
	PoolId    uint64 `gorm:"index:idx_pool_id,unique"`
	Liquidity string
	Volume    string
}

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func New

func New(db *gorm.DB, logger *slog.Logger) (*Repository, error)

func (*Repository) Close

func (r *Repository) Close() error

func (*Repository) IBCDenom

func (r *Repository) IBCDenom(ibc string) (IBCTypes.DenomTrace, bool)

func (*Repository) IBCDenomAll

func (r *Repository) IBCDenomAll() []IBCTypes.DenomTrace

func (*Repository) LatestPool

func (r *Repository) LatestPool(id uint64) (repository.Pool, bool)

LatestPool will return latest pool

func (*Repository) LatestTokenPrice

func (r *Repository) LatestTokenPrice(denom string) (repository.TokenPrice, bool)

LatestTokenPrice will return latest token price.

func (*Repository) NearestTokenPrice

func (r *Repository) NearestTokenPrice(timestamp time.Time, denom string) ([]repository.TokenPrice, bool)

FIXME

func (*Repository) PoolsRange

func (r *Repository) PoolsRange(min, max, poolId uint64) ([]repository.Pool, error)

PoolsRange will return pools from min to max height

func (*Repository) PrunePools

func (r *Repository) PrunePools(height uint64) (int, error)

PrunePools will remove all pools prior block height.

func (*Repository) PruneTokenPrices

func (r *Repository) PruneTokenPrices(timestamp time.Time) (int, error)

PruneTokenPrices will remove all token prices prior timestamp.

func (*Repository) SaveIBCDenom

func (r *Repository) SaveIBCDenom(ibc IBCTypes.DenomTrace) error

func (*Repository) SavePool

func (r *Repository) SavePool(pool repository.Pool) error

func (*Repository) SaveTokenPrice

func (r *Repository) SaveTokenPrice(price repository.TokenPrice) error

func (*Repository) TokenPrice

func (r *Repository) TokenPrice(timestamp time.Time, denom string) (repository.TokenPrice, bool)

func (*Repository) TokenPricesRange

func (r *Repository) TokenPricesRange(min, max time.Time, denom string) ([]repository.TokenPrice, error)

type TokenPrice

type TokenPrice struct {
	CreatedAt   time.Time
	UpdatedAt   time.Time
	LastUpdated int64 `gorm:"index:idx_token_price,unique"`
	Value       float64
	Name        string `gorm:"index:idx_token_price,unique"`
	Base        string `gorm:"index:idx_token_price,unique"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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