dex

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FactoryAddrIdx = iota
	FactoryActionIdx
	FactoryPairIdx
	FactoryPairAddrIdx
	FactoryLpAddrIdx
)
View Source
const (
	TransferAmountKey    = "amount"
	TransferRecipientKey = "recipient"
	TransferSenderKey    = "sender"
)
View Source
const (
	WasmTransferAction     = "transfer"
	WasmTransferFromAction = "transfer_from"
)
View Source
const (
	WasmTransferLegacyCw20AddrKey = "contract_address"
	WasmTransferCw20AddrKey       = "_contract_address"
	WasmTransferActionKey         = "action"
	WasmTransferAmountKey         = "amount"
	WasmTransferFromKey           = "from"
	WasmTransferToKey             = "to"

	WasmTransferTaxFlagPatternKey = "tax"
)
View Source
const (
	PairInitialProvideAddrIdx = iota
	PairInitialProvideActionIdx
	PairInitialProvideAmountIdx
	PairInitialProvideToIdx
	PairInitialProvideMatchedLen
)
View Source
const (
	PairInitialProvideAddrKey   = "_contract_address"
	PairInitialProvideActionKey = "action"
	PairInitialProvideAmountKey = "amount"
	PairInitialProvideToKey     = "to"
)
View Source
const (
	PairTaxPaymentReverseChargeIdx = iota
	PairTaxPaymentTaxAmountIdx
	PairTaxPaymentTaxMatchedLen
)
View Source
const (
	PairTaxPaymentReverseChargeKey = "reverse_charge"
	PairTaxPaymentTaxAmountKey     = "tax_amount"
)
View Source
const (
	BurnAddrIdx = iota
	BurnActionIdx
	BurnAmountIdx
	BurnFromIdx
	BurnMatchedLen
)
View Source
const (
	BurnAddrKey   = "_contract_address"
	BurnActionKey = "action"
	BurnAmountKey = "amount"
	BurnFromKey   = "from"
)
View Source
const (
	PairSwapAskAssetKey         = "ask_asset"
	PairSwapCommissionAmountKey = "commission_amount"
	PairSwapOfferAmountKey      = "offer_amount"
	PairSwapOfferAssetKey       = "offer_asset"
	PairSwapReceiverKey         = "receiver"
	PairSwapReturnAmountKey     = "return_amount"
	PairSwapTaxAmountKey        = "tax_amount" // columbus-5
	PairSwapSenderKey           = "sender"
	PairSwapSpreadAmountKey     = "spread_amount"
)
View Source
const (
	CreatePairMatchedLen = FactoryLpAddrIdx + 1
)

Variables

View Source
var (
	PAIR_QUERY_POOL_STRING, _        = QueryToJsonStr[PoolInfoReq](PoolInfoReq{})
	PAIR_QUERY_POOL_BASE64_STRING, _ = QueryToBase64Str[PoolInfoReq](PoolInfoReq{})
)
View Source
var (
	ErrQueryDifferentHeight = errors.New("query different height")
	ErrEmptyEventValue      = errors.New("empty event value")
)

Functions

func CreateBurnRuleFinder added in v0.1.2

func CreateBurnRuleFinder() (eventlog.LogFinder, error)

func CreatePairInitialProvideRuleFinder

func CreatePairInitialProvideRuleFinder(pairs map[string]bool) (eventlog.LogFinder, error)

func QueryToBase64Str

func QueryToBase64Str[T ContractQueryRequest](query T) (string, error)

func QueryToJsonStr

func QueryToJsonStr[T ContractQueryRequest](query T) (string, error)

Types

type Asset

type Asset struct {
	Info   AssetInfo `json:"info"`
	Amount string    `json:"amount"`
}

type AssetCWToken

type AssetCWToken struct {
	ContractAddr string `json:"contract_addr,omitempty"`
}

type AssetInfo

type AssetInfo struct {
	Token       *AssetCWToken     `json:"token,omitempty"`
	NativeToken *AssetNativeToken `json:"native_token,omitempty"`
}

type AssetNativeToken

type AssetNativeToken struct {
	Denom string `json:"denom,omitempty"`
}

type ContractQueryRequest

type ContractQueryRequest interface {
	FactoryPairsReq | PoolInfoReq
}

type DexType

type DexType string
const (
	Terraswap DexType = "terraswap"
	Dezswap   DexType = "dezswap"
	Starfleit DexType = "starfleit"
	Unknown   DexType = ""
)

func ToDexType

func ToDexType(candidate string) DexType

type FactoryPairsReq

type FactoryPairsReq struct {
	Pairs struct {
		Limit      int           `json:"limit,omitempty"`
		StartAfter *[2]AssetInfo `json:"start_after,omitempty"`
	} `json:"pairs"`
}

type FactoryPairsRes

type FactoryPairsRes struct {
	Pairs []Pair `json:"pairs"`
}

type MapperMixin

type MapperMixin struct {
}

func (*MapperMixin) CheckResult

func (m *MapperMixin) CheckResult(res eventlog.MatchedResult, minLen int) error

func (*MapperMixin) SortResult

func (*MapperMixin) SortResult(res eventlog.MatchedResult)

SortResult sorts the result by key split by "_contract_address" @param res will be sorted

type Pair

type Pair struct {
	AssetInfos     [2]AssetInfo `json:"asset_infos"`
	ContractAddr   string       `json:"contract_addr"`
	LiquidityToken string       `json:"liquidity_token"`
	AssetDecimals  *[2]uint8    `json:"asset_decimals,omitempty"`
}

type PoolInfoReq

type PoolInfoReq struct {
	Pool struct{} `json:"pool"`
}

type PoolInfoRes

type PoolInfoRes struct {
	Assets     []Asset `json:"assets"`
	TotalShare string  `json:"total_share"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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