schema

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// msg from lp
	LpMsgEventRegister = "register"
	LpMsgEventAdd      = "add"
	LpMsgEventRemove   = "remove"
	LpMsgEventSign     = "sign"
	LpMsgEventReject   = "reject"

	// msg to lp
	LpMsgEventResponse       = "response"
	LpMsgEventSalt           = "salt" // salt for register
	LpMsgEventOrder          = "order"
	LpMsgEventAddResponse    = "addResponse"    // response to add lp
	LpMsgEventRemoveResponse = "removeResponse" // response to remove lp

)
View Source
const (
	OrderStatusPending = "pending"
	OrderStatusSuccess = "success"
	OrderStatusFailed  = "failed"
	OrderStatusExpired = "expired"

	OrderMsgEventStatus = "status"

	OrderExpire = 10 * time.Second // order life cycle
)
View Source
const (
	LpPenaltyForNoSign            = "lp_no_sign"
	LpPenaltyForNoEnoughBalance   = "lp_no_enough_balance"
	UserPenaltyForNoEnoughBalance = "user_no_enough_balance"
)
View Source
const (
	// msg from user
	UserMsgEventQuery  = "query"
	UserMsgEventSubmit = "submit"

	// msg to user
	UserMsgEventResponse = "response"
	UserMsgEventOrder    = "order"
)

Variables

View Source
var (
	// response msg
	LpMsgOk = LpMsgResponse{Event: LpMsgEventResponse, Msg: "ok"}
)

Functions

This section is empty.

Types

type AccountStatsRes

type AccountStatsRes struct {
	Address string          `json:"address"`
	Volumes []Volume        `json:"volumes"`
	Rewards []PermaLpReward `json:"rewards"`
	TVLs    []TVL           `json:"tvls"`
}

type ArNFT

type ArNFT struct {
	ContractAddr   string `json:"contractAddr"`
	TokenId        string `json:"tokenId"`
	Owner          string `json:"owner"`
	Name           string `json:"name"`
	CollectionName string `json:"collectionName"`
	ImageUrl       string `json:"imageUrl"`
	Timestamp      int64  `json:"timestamp"`
	DataUrl        string `json:"dataUrl"`
}

type Collect

type Collect struct {
	Slug       string       `json:"slug"`
	Name       string       `json:"name"`
	ImageUrl   string       `json:"image_url"`
	CreateTime string       `json:"created_date"`
	Stats      CollectStats `json:"stats"`
}

type CollectStats

type CollectStats struct {
	Count      float64 `json:"count"`
	NumOwners  int64   `json:"num_owners"`
	FloorPrice float64 `json:"floor_price"`
}

type FailureRecord

type FailureRecord struct {
	Accid     string `json:"accid"`
	Timestamp int64  `json:"timestamp"`
	EverHash  string `json:"everHash"`
	Reason    string `json:"reason"`
}

type InfoRes

type InfoRes struct {
	ChainID       int64                    `json:"chainID"`
	RouterAddress string                   `json:"routerAddress"`
	NFTWhiteList  bool                     `json:"nftWhiteList"`
	TokenList     []string                 `json:"tokenList"`
	PoolList      map[string]*schema.Pool  `json:"poolList"`
	LpClientInfo  map[string]*LpClientInfo `json:"lpClientInfo"`
}

type LpClientInfo

type LpClientInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type LpMsg

type LpMsg struct {
	Event string `json:"event"`
}

type LpMsgAdd

type LpMsgAdd struct {
	ID    string `json:"id"`
	Event string `json:"event"`

	TokenX   string       `json:"tokenX"`
	TokenY   string       `json:"tokenY"`
	FeeRatio *apd.Decimal `json:"feeRatio"`

	CurrentSqrtPrice *apd.Decimal `json:"currentSqrtPrice"`
	LowSqrtPrice     *apd.Decimal `json:"lowSqrtPrice"`
	HighSqrtPrice    *apd.Decimal `json:"highSqrtPrice"`
	Liquidity        string       `json:"liquidity"`
	PriceDirection   string       `json:"priceDirection"`
}

func (LpMsgAdd) Marshal

func (l LpMsgAdd) Marshal() []byte

type LpMsgAddResponse

type LpMsgAddResponse struct {
	Event string `json:"event"`
	LpID  string `json:"lpID"`
	Msg   string `json:"msg"` // "ok" or "failed"
	Error string `json:"error"`
}

func (LpMsgAddResponse) Marshal

func (l LpMsgAddResponse) Marshal() []byte

type LpMsgOrder

type LpMsgOrder struct {
	Event    string            `json:"event"`
	UserAddr string            `json:"userAddr"`
	Bundle   everSchema.Bundle `json:"bundle"`
	Paths    []coreSchema.Path `json:"paths"`
}

func (LpMsgOrder) Marshal

func (l LpMsgOrder) Marshal() []byte

type LpMsgRegister

type LpMsgRegister struct {
	ID              string `json:"id"`
	Event           string `json:"event"`
	Address         string `json:"address"`
	Sig             string `json:"sig"`
	LpClientName    string `json:"lpClientName"`
	LpClientVersion string `json:"lpClientVerison"`
}

func (LpMsgRegister) Marshal

func (l LpMsgRegister) Marshal() []byte

type LpMsgReject

type LpMsgReject struct {
	ID        string `json:"id"`
	Event     string `json:"event"`
	Address   string `json:"address"`
	OrderHash string `json:"orderHash"`
}

func (LpMsgReject) Marshal

func (l LpMsgReject) Marshal() []byte

type LpMsgRemove

type LpMsgRemove struct {
	ID    string `json:"id"`
	Event string `json:"event"`

	TokenX   string       `json:"tokenX"`
	TokenY   string       `json:"tokenY"`
	FeeRatio *apd.Decimal `json:"feeRatio"`

	LowSqrtPrice   *apd.Decimal `json:"lowSqrtPrice"`
	HighSqrtPrice  *apd.Decimal `json:"highSqrtPrice"`
	PriceDirection string       `json:"priceDirection"`
}

func (LpMsgRemove) Marshal

func (l LpMsgRemove) Marshal() []byte

type LpMsgRemoveResponse

type LpMsgRemoveResponse struct {
	Event string `json:"event"`
	LpID  string `json:"lpID"`
	Msg   string `json:"msg"` // "ok" or "failed"
	Error string `json:"error"`
}

func (LpMsgRemoveResponse) Marshal

func (l LpMsgRemoveResponse) Marshal() []byte

type LpMsgResponse

type LpMsgResponse struct {
	Event string `json:"event"`
	Msg   string `json:"msg"`
}

func (LpMsgResponse) Marshal

func (l LpMsgResponse) Marshal() []byte

type LpMsgSalt

type LpMsgSalt struct {
	Event string `json:"event"`
	Salt  string `json:"salt"`
}

func (LpMsgSalt) Marshal

func (l LpMsgSalt) Marshal() []byte

type LpMsgSign

type LpMsgSign struct {
	ID      string                    `json:"id"`
	Event   string                    `json:"event"`
	Address string                    `json:"address"`
	Bundle  everSchema.BundleWithSigs `json:"bundle"`
}

func (LpMsgSign) Marshal

func (l LpMsgSign) Marshal() []byte

type LpRewardsRes

type LpRewardsRes struct {
	Address string           `json:"address"`
	LpID    string           `json:"lpID"`
	Rewards []*PermaLpReward `json:"rewards"`
}

type LpsRes

type LpsRes struct {
	Lps []schema.Lp `json:"lps"`
}

type NFTRes

type NFTRes struct {
	NFTToHolder  map[string]string   `json:"nftToHolder"`
	HolderToNFTs map[string][]string `json:"holderToNFTs"`
	WhiteList    []string            `json:"whitelist"`
}

type NFTWhiteList

type NFTWhiteList struct {
	ID        int64      `gorm:"primary_key;auto_increment"`
	UpdatedAt *time.Time `gorm:"ASSOCIATION_AUTOUPDATE"`
	CreatedAt *time.Time `gorm:"ASSOCIATION_AUTOCREATE"`
	UserAddr  string
	Remark    string
}

type OrderMsgStatus

type OrderMsgStatus struct {
	Event     string `json:"event" default:"status"`
	OrderHash string `json:"orderHash"`
	EverHash  string `json:"everHash"`
	Status    string `json:"status"`
}

func (OrderMsgStatus) Marshal

func (o OrderMsgStatus) Marshal() []byte

type OrdersRes

type OrdersRes struct {
	//Total  int64         `json:"total"`
	Orders []*PermaOrder `json:"orders"`
}

type PenaltyRes

type PenaltyRes struct {
	ExpirationDuration int64                      `json:"expirationDuration"`
	CumulativeFailures int64                      `json:"cumulativeFailures"`
	FailureRecords     map[string][]FailureRecord `json:"failureRecords"`
	BlackList          map[string]int64           `json:"blackList"`
}

type PermaLpReward

type PermaLpReward struct {
	ID        int64      `gorm:"primary_key;auto_increment" json:"id"`
	CreatedAt *time.Time `gorm:"ASSOCIATION_AUTOCREATE" json:"-"`
	LpID      string     `gorm:"index:plrindex1,unique" json:"lpID"`
	PoolID    string     `json:"poolID"`
	AccID     string     `json:"accID"`
	RewardX   float64    `json:"rewardX"`
	RewardY   float64    `json:"rewardY"`
}

type PermaLpsSnapshot

type PermaLpsSnapshot struct {
	ID        int64      `gorm:"primary_key;auto_increment" json:"id"`
	CreatedAt *time.Time `gorm:"ASSOCIATION_AUTOCREATE" json:"-"`
	UpdatedAt *time.Time `gorm:"ASSOCIATION_AUTOUPDATE" json:"-"`
	Lps       string     `gorm:"type:longtext"` //json text of all lps snapshot
}

type PermaOrder

type PermaOrder struct {
	ID             int64      `gorm:"primary_key;auto_increment" json:"id"`
	UpdatedAt      *time.Time `gorm:"ASSOCIATION_AUTOUPDATE" json:"-"`
	CreatedAt      *time.Time `gorm:"ASSOCIATION_AUTOCREATE" json:"-"`
	UserAddr       string     `gorm:"index:poindex1" json:"address"`
	EverHash       string     `gorm:"index:poindex2" json:"everHash"`
	TokenInTag     string     `json:"tokenInTag"`
	TokenOutTag    string     `json:"tokenOutTag"`
	TokenInAmount  string     `json:"tokenInAmount"`
	TokenOutAmount string     `json:"tokenOutAmount"`
	Price          string     `json:"price"`
	OrderStatus    string     `json:"status"`
	OrderTimestamp int64      `json:"timestamp"` // nonce
}

type PermaVolume

type PermaVolume struct {
	ID              int64      `gorm:"primary_key;auto_increment" json:"id"`
	CreatedAt       *time.Time `gorm:"ASSOCIATION_AUTOCREATE" json:"-"`
	OrderID         int64      `json:"orderId"`
	EverHash        string     `json:"everHash"`
	PoolID          string     `json:"poolID"`
	AccID           string     `json:"accID"`
	LpID            string     `json:"lpID"`
	TokenXIsTokenIN bool       `json:"tokenXIsTokenIn"`
	AmountX         float64    `json:"amountX"`
	AmountY         float64    `json:"amountY"`
	RewardX         float64    `json:"rewardX"`
	RewardY         float64    `json:"rewardY"`
}

type PoolRes

type PoolRes struct {
	schema.Pool
	CurrentPriceUP   string      `json:"currentPriceUp"`
	CurrentPriceDown string      `json:"currentPriceDown"`
	Lps              []schema.Lp `json:"lps"`
}

type PoolStatsRes

type PoolStatsRes struct {
	PoolID string `json:"poolID"`
	Volume Volume `json:"volume"`
	TVL    TVL    `json:"tvl"`
}

type ResNFT

type ResNFT struct {
	ContractAddr      string  `json:"contractAddr"`
	TokenId           string  `json:"tokenId"`
	PermaLink         string  `json:"permaLink"`
	Collection        Collect `json:"collection"`
	ImageUrl          string  `json:"imageUrl"`
	Name              string  `json:"name"`
	NameDes           string  `json:"nameDes"`
	Price             string  `json:"price"`
	PriceSymbol       string  `json:"priceSymbol"`
	TopOffer          string  `json:"topOffer"`
	TopOfferSymbol    string  `json:"topOfferSymbol"`
	MinOffer          string  `json:"minOffer"`
	MinOfferSymbol    string  `json:"minOfferSymbol"`
	AuctionType       string  `json:"auctionType"`
	Owner             string  `json:"owner"`
	OwnerLink         string  `json:"ownerLink"`
	CollectionName    string  `json:"collectionName"`
	CollectionNameDes string  `json:"collectionNameDes"`
	Timestamp         int64   `json:"timestamp"`
}

type SumPermaVolumeRes

type SumPermaVolumeRes struct {
	PoolID  string  `json:"poolID"`
	AccID   string  `json:"accID"`
	LpID    string  `json:"lpID"`
	AmountX float64 `json:"amountX"`
	AmountY float64 `json:"amountY"`
	RewardX float64 `json:"rewardX"`
	RewardY float64 `json:"rewardY"`
}

type TVL

type TVL struct {
	Timestamp int64   `json:"timestamp"`
	PoolID    string  `json:"poolID"`
	LpID      string  `json:"lpID"`
	AccID     string  `json:"accID"`
	X         float64 `json:"tokenXTVL"`
	Y         float64 `json:"tokenYTVL"`
	USD       float64 `json:"tvlInUSD"`
}

type UserMsg

type UserMsg struct {
	Event string `json:"event"`
}

type UserMsgOrder

type UserMsgOrder struct {
	Event       string            `json:"event" default:"order"`
	UserAddr    string            `json:"userAddr"`
	TokenIn     string            `json:"tokenIn"`
	TokenOut    string            `json:"tokenOut"`
	Price       string            `json:"price"`
	PriceImpact string            `json:"priceImpact"`
	Bundle      everSchema.Bundle `json:"bundle"`
	Paths       []coreSchema.Path `json:"paths"`
}

func (UserMsgOrder) Marshal

func (u UserMsgOrder) Marshal() []byte

type UserMsgQuery

type UserMsgQuery struct {
	ID       string `json:"id"`
	Event    string `json:"event"`
	Address  string `json:"address"`
	TokenIn  string `json:"tokenIn"`
	TokenOut string `json:"tokenOut"`
	AmountIn string `json:"amountIn"`
}

{"event":"query","address":"123","tokenIn":"ethereum-eth-0x0000000000000000000000000000000000000000","tokenOut":"ethereum-usdc-0xb7a4f3e9097c08da09517b5ab877f7a917224ede", "amountIn":"4000000000000000"}

func (UserMsgQuery) Marshal

func (l UserMsgQuery) Marshal() []byte

type UserMsgResponse

type UserMsgResponse struct {
	Event string `json:"event"`
	Msg   string `json:"msg"`
}

func (UserMsgResponse) Marshal

func (l UserMsgResponse) Marshal() []byte

type UserMsgSubmit

type UserMsgSubmit struct {
	ID       string                    `json:"id"`
	Event    string                    `json:"event"`
	Address  string                    `json:"address"`
	TokenIn  string                    `json:"tokenIn"`
	TokenOut string                    `json:"tokenOut"`
	Bundle   everSchema.BundleWithSigs `json:"bundle"`
	Paths    []coreSchema.Path         `json:"paths"`
}

func (UserMsgSubmit) Marshal

func (l UserMsgSubmit) Marshal() []byte

type Volume

type Volume struct {
	//Duration  int64 `json:"duration"` // in minutes
	Timestamp int64   `json:"timestamp"`
	PoolID    string  `json:"poolID"`
	AccID     string  `json:"accID"`
	LpID      string  `json:"lpID"`
	TokenX    string  `json:"tokenX"`
	TokenY    string  `json:"tokenY"`
	X         float64 `json:"volumeX"`
	Y         float64 `json:"volumeY"`
	USD       float64 `json:"volumeInUSD"`
	RewardX   float64 `json:"rewardX"`
	RewardY   float64 `json:"rewardY"`
	RewardUSD float64 `json:"rewardInUSD"`
}

Jump to

Keyboard shortcuts

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