domain

package
v27.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNodeIsSyncing = errors.New("node is syncing, skipping block processing")
)

Functions

This section is empty.

Types

type BankKeeper

type BankKeeper interface {
	GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins
}

BankKeeper is an interface for getting bank balances.

type BlockPools

type BlockPools struct {
	// ConcentratedPools are the concentrated pools to be ingested.
	ConcentratedPools []poolmanagertypes.PoolI
	// ConcentratedPoolIDTickChange is the map of pool ID to tick change for concentrated pools.
	// We use these pool IDs to append concentrated pools with all ticks at the end of the block.
	ConcentratedPoolIDTickChange map[uint64]struct{}
	// CosmWasmPools are the CosmWasm pools to be ingested.
	CosmWasmPools []poolmanagertypes.PoolI
	// CFMMPools are the CFMM pools to be ingested.
	CFMMPools []poolmanagertypes.PoolI
}

BlockPools contains the pools to be ingested in a block.

func (BlockPools) GetAll

func (bp BlockPools) GetAll() []poolmanagertypes.PoolI

type BlockProcessStrategyManager

type BlockProcessStrategyManager interface {
	// ShouldPushAllData returns true if all data should be pushed.
	ShouldPushAllData() bool

	// MarkInitialDataIngested marks the initial data as ingested.
	// After calling this function, ShouldPushAllData should return false.
	MarkInitialDataIngested()

	// MarkErrorObserved marks that an error has been observed.
	MarkErrorObserved()
}

BlockProcessStrategyManager is an interface for managing the strategy of pushing the blocks. Either all block data or only the block update are the possible options It is initialized with the strategy of pushing all data. If it observes an error, it will switch to pushing all data. If it ingested initial data and observed no error, it will switch to pushing only changed data.

func NewBlockProcessStrategyManager

func NewBlockProcessStrategyManager() BlockProcessStrategyManager

NewBlockProcessStrategyManager creates a new push strategy manager.

type BlockProcessor

type BlockProcessor interface {
	// ProcessBlock processes a block.
	// It returns an error if the block processing fails.
	ProcessBlock(ctx sdk.Context) error

	// IsFullBlockProcessor returns true if the block processor is a full block processor.
	IsFullBlockProcessor() bool
}

BlockProcessor is an interface for processing a block.

type BlockUpdateProcessUtils

type BlockUpdateProcessUtils struct {
	WriteListeners map[storetypes.StoreKey][]WriteListener
	StoreKeyMap    map[string]storetypes.StoreKey
	ChangeSet      []*storetypes.StoreKVPair
}

BlockUpdateProcessUtils is a struct that implements BlockUpdateProcessUtilsI and contains the necessary data to process the block change set.

func (*BlockUpdateProcessUtils) ProcessBlockChangeSet

func (b *BlockUpdateProcessUtils) ProcessBlockChangeSet() error

ProcessBlockChangeSet implements BlockUpdateProcessUtilsI.

func (*BlockUpdateProcessUtils) SetChangeSet

func (b *BlockUpdateProcessUtils) SetChangeSet(changeSet []*storetypes.StoreKVPair)

SetChangeSet implements BlockUpdateProcessUtilsI.

type BlockUpdateProcessUtilsI

type BlockUpdateProcessUtilsI interface {
	// ProcessBlockChangeSet processes the change set and notifies the write listeners.
	ProcessBlockChangeSet() error

	// SetChangeSet sets the change set on the block update process utils.
	SetChangeSet(changeSet []*storetypes.StoreKVPair)
}

BlockPoolUpdateTracker is an interface that defines the methods for the block pool update tracker.

type ConcentratedKeeper

type ConcentratedKeeper interface {
	PoolKeeper
	GetTickLiquidityForFullRange(ctx sdk.Context, poolId uint64) ([]queryproto.LiquidityDepthWithRange, int64, error)
	GetConcentratedPoolById(ctx sdk.Context, poolId uint64) (concentratedtypes.ConcentratedPoolExtension, error)
}

ConcentratedKeeper is an interface for the concentrated keeper.

type CosmWasmPoolKeeper

type CosmWasmPoolKeeper interface {
	GetPoolsWithWasmKeeper(ctx sdk.Context) ([]poolmanagertypes.PoolI, error)
}

CosmWasmPoolKeeper is an interface for getting CosmWasm pools from a keeper.

type NodeSyncCheckError

type NodeSyncCheckError struct {
	Err error
}

func (*NodeSyncCheckError) Error

func (e *NodeSyncCheckError) Error() string

type PoolCreation

type PoolCreation struct {
	PoolId      uint64
	BlockHeight int64
	BlockTime   time.Time
	TxnHash     string
}

PoolCreation contains the information about a pool creation.

type PoolExtractor

type PoolExtractor interface {
	// ExtractAll extracts all the pools available within the height associated
	// with the context.
	ExtractAll(ctx sdk.Context) (BlockPools, map[uint64]PoolCreation, error)
	// ExtractChanged extracts the pools that were changed in the block height associated
	// with the context.
	ExtractChanged(ctx sdk.Context) (BlockPools, error)
	// ExtractrCreated extracts the pools that were created in the block height associated
	// with the context.
	ExtractCreated(ctx sdk.Context) (BlockPools, map[uint64]PoolCreation, error)
}

PoolExtractor defines the interface for extracting pools.

type PoolExtractorKeepers

type PoolExtractorKeepers struct {
	GammKeeper         PoolKeeper
	CosmWasmPoolKeeper CosmWasmPoolKeeper
	WasmKeeper         WasmKeeper
	BankKeeper         BankKeeper
	ProtorevKeeper     ProtorevKeeper
	PoolManagerKeeper  PoolManagerKeeper
	ConcentratedKeeper ConcentratedKeeper
}

Chain keepers required for extracting pool data.

type PoolKeeper

type PoolKeeper interface {
	GetPools(ctx sdk.Context) ([]poolmanagertypes.PoolI, error)
}

PoolKeeper is an interface for getting pools from a keeper.

type PoolManagerKeeper

type PoolManagerKeeper interface {
	RouteCalculateSpotPrice(
		ctx sdk.Context,
		poolId uint64,
		quoteAssetDenom string,
		baseAssetDenom string,
	) (price osmomath.BigDec, err error)

	SwapExactAmountIn(
		ctx sdk.Context,
		sender sdk.AccAddress,
		poolId uint64,
		tokenIn sdk.Coin,
		tokenOutDenom string,
		tokenOutMinAmount osmomath.Int,
	) (tokenOutAmount osmomath.Int, takerFeeTotal sdk.Coin, err error)

	RouteGetPoolDenoms(
		ctx sdk.Context,
		poolId uint64,
	) (denoms []string, err error)

	GetTradingPairTakerFee(ctx sdk.Context, denom0, denom1 string) (osmomath.Dec, error)

	MultihopEstimateInGivenExactAmountOut(
		ctx sdk.Context,
		route []poolmanagertypes.SwapAmountOutRoute,
		tokenOut sdk.Coin,
	) (tokenInAmount osmomath.Int, err error)
}

PoolManagerKeeper is an interface for the pool manager keeper.

type ProtorevKeeper

type ProtorevKeeper interface {
	GetPoolForDenomPair(ctx sdk.Context, baseDenom, denomToMatch string) (uint64, error)
}

ProtorevKeeper is an interface for getting the pool for a denom pair.

type WasmKeeper

type WasmKeeper interface {
	QueryRaw(ctx context.Context, contractAddress sdk.AccAddress, key []byte) []byte
	QuerySmart(ctx context.Context, contractAddress sdk.AccAddress, req []byte) ([]byte, error)
}

WasmKeeper is an interface for querying CosmWasm contract.

type WriteListener

type WriteListener interface {
	OnWrite(storeKey storetypes.StoreKey, key []byte, value []byte, delete bool) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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