domain

package
v28.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDidNotIngestAllData = errors.New("cold start manager has not yet ingested initial data")

Functions

func IsMultiDenom

func IsMultiDenom(denoms []string) bool

IsMultiDenom returns true if the given denoms has >2 denoms

func ShouldFilterDenom

func ShouldFilterDenom(denom string) bool

ShouldFilterDenom returns true if the given denom should be filtered out.

Types

type Block

type Block struct {
	ChainId     string    `json:"chain_id"`
	Height      uint64    `json:"height"`
	BlockTime   time.Time `json:"timestamp"`
	GasConsumed uint64    `json:"gas_consumed"`
	IngestedAt  time.Time `json:"ingested_at"`
}

type EventWrapper

type EventWrapper struct {
	Index int         `json:"event_index"`
	Event types.Event `json:"event"`
}

map data type is unsupported by the dataflow / apache beam thus using struct to represent the data

type Keepers

type Keepers struct {
	BankKeeper        bankkeeper.Keeper
	PoolManagerKeeper PoolManagerKeeperI
}

type Pair

type Pair struct {
	PoolID               uint64    `json:"pool_id"`
	MultiAsset           bool      `json:"multi_asset"`
	Denom0               string    `json:"denom_0"`
	IdxDenom0            uint8     `json:"idx_denom_0"`
	Denom1               string    `json:"denom_1"`
	IdxDenom1            uint8     `json:"idx_denom_1"`
	FeeBps               uint64    `json:"fee_bps"`
	IngestedAt           time.Time `json:"ingested_at"`
	PairCreatedAt        time.Time `json:"pair_created_at"`
	PairCreatedAtHeight  uint64    `json:"pair_created_at_height"`
	PairCreatedAtTxnHash string    `json:"pair_created_at_txn_hash"`
}

Pair represents a pair of tokens in a pool and message to be published to PubSub

type PairPublisher

type PairPublisher interface {
	// PublishPoolPairs publishes the given pools as pairs.
	// The difference between this function and PublishPair is:
	// - PublishPair operates on the pair level and publishes a single pair.
	// - PublishPoolPairs operates on the pool level and publishes all the pair combo in the pool
	//   with the taker fee and spread factor, as well as the newly created pool metadata, if any.
	PublishPoolPairs(ctx sdk.Context, pools []poolmanagertypes.PoolI, createdPoolIDs map[uint64]commondomain.PoolCreation) error
}

PairPublisher is an interface for publishing pair data.

type PoolManagerKeeperI

type PoolManagerKeeperI interface {
	GetTradingPairTakerFee(ctx sdk.Context, denom0, denom1 string) (osmomath.Dec, error)
	GetTotalPoolLiquidity(ctx sdk.Context, poolId uint64) (sdk.Coins, error)
	GetPool(ctx sdk.Context, poolId uint64) (types.PoolI, error)
	RouteCalculateSpotPrice(ctx sdk.Context, poolId uint64, quoteAssetDenom string, baseAssetDenom string) (price osmomath.BigDec, err error)
}

type Publisher

type Publisher interface {
	TokenSupplyPublisher

	PublishBlock(ctx context.Context, block Block) error
	PublishTransaction(ctx context.Context, txn Transaction) error
	PublishPair(ctx context.Context, pair Pair) error
}

Publisher is an interface for publishing various types of data.

type TokenSupply

type TokenSupply struct {
	Denom      string       `json:"denom"`
	Supply     osmomath.Int `json:"supply"`
	IngestedAt time.Time    `json:"ingested_at"`
}

type TokenSupplyOffset

type TokenSupplyOffset struct {
	Denom        string       `json:"denom"`
	SupplyOffset osmomath.Int `json:"supply_offset"`
	IngestedAt   time.Time    `json:"ingested_at"`
}

type TokenSupplyPublisher

type TokenSupplyPublisher interface {
	PublishTokenSupply(ctx context.Context, tokenSupply TokenSupply) error
	PublishTokenSupplyOffset(ctx context.Context, tokenSupplyOffset TokenSupplyOffset) error
}

TokenSupplyPublisher is an interface for publishing token supply data.

type Transaction

type Transaction struct {
	Height             uint64         `json:"height"`
	BlockTime          time.Time      `json:"timestamp"`
	GasWanted          uint64         `json:"gas_wanted"`
	GasUsed            uint64         `json:"gas_used"`
	Fees               sdk.Coins      `json:"fees"`
	MessageType        string         `json:"msg_type"`
	TransactionHash    string         `json:"tx_hash"`
	TransactionIndexId int            `json:"tx_index_id"`
	Events             []EventWrapper `json:"events"`
	IngestedAt         time.Time      `json:"ingested_at"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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