collections

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressCollection

type AddressCollection []common.Address

func (*AddressCollection) Contains

func (ac *AddressCollection) Contains(address common.Address) bool

Contains returns true if the given string is in the slice.

type BaseCollection added in v0.2.0

type BaseCollection struct{}

type CollectionDB added in v0.2.0

type CollectionDB struct {
	Collections map[common.Address]*GbCollection

	// 'queue' to store collections to be processed
	// ListingAddresses chan common.Address
	RWMu *sync.RWMutex
}

func New

func New() *CollectionDB

func (*CollectionDB) Addresses added in v0.2.0

func (cs *CollectionDB) Addresses() []common.Address

func (*CollectionDB) ListingsAddresses added in v0.2.0

func (cs *CollectionDB) ListingsAddresses() []common.Address

ListingsAddresses returns a slice of addresses.

func (*CollectionDB) OpenseaSlugs added in v0.2.0

func (cs *CollectionDB) OpenseaSlugs() []string

OpenseaSlugs returns a slice of slugs for collections with enabled listings.

func (*CollectionDB) SortedAndColoredNames added in v0.2.0

func (cs *CollectionDB) SortedAndColoredNames() []string

func (*CollectionDB) UserCollectionsAddresses added in v0.2.0

func (cs *CollectionDB) UserCollectionsAddresses() []common.Address

type Event

type Event struct {
	NodeID               int
	EventType            EventType
	Topic                string
	TxHash               common.Hash
	TransactionCollector *txlogcollector.TxLogs
	ContractAddress      common.Address
	Collection           *GbCollection
	TokenID              *big.Int
	UniqueTokenIDs       []*big.Int
	ENSMetadata          *external.ENSMetadata
	PriceWei             *big.Int
	PriceArrowColor      lipgloss.Color
	CollectionColor      lipgloss.Color
	Permalink            string
	TxLogCount           uint64
	Time                 time.Time
	From                 User
	FromENS              string
	To                   User
	ToColor              lipgloss.Color
	ToENS                string
	FromAddresses        map[common.Address]bool
	ToAddresses          map[common.Address]bool
	WorkerID             int
	PrintEvent           bool
}

type EventType

type EventType int64
const (
	Sale EventType = iota
	Mint
	Transfer
	Listing
	Purchase
)

func (EventType) ActionName

func (et EventType) ActionName() string

func (EventType) Icon

func (et EventType) Icon() string

func (EventType) String added in v0.0.12

func (et EventType) String() string

type EventWithStyle added in v0.0.16

type EventWithStyle struct {
	Verbose bool

	Source      string
	SourceColor lipgloss.Color

	Time      time.Time
	TimeColor lipgloss.Color

	EventType  EventType
	EventEmoji string

	Marker      string
	MarkerColor lipgloss.Color

	TxHash common.Hash

	CollectionName        string
	CollectionColor       lipgloss.Color
	CollectionTotalSupply uint64
	TokenID               *big.Int

	PriceEther      string
	PriceEtherColor lipgloss.Color
	PriceArrowColor lipgloss.Color
	PriceWei        *big.Int
	PricePerItem    *big.Int

	TxItemCount uint64

	EtherscanURL string
	OpenseaURL   string

	From      User
	FromColor lipgloss.Color
	FromENS   string

	To      User
	ToColor lipgloss.Color
	ToENS   string

	SalesCount    uint64
	ListingsCount uint64
}

type GbCollection

type GbCollection struct {
	//
	// configurable fields
	ContractAddress common.Address `mapstructure:"address"`
	Name            string         `mapstructure:"name"`
	OpenseaSlug     string         `mapstructure:"slug"`
	IgnorePrinting  bool           `mapstructure:"ignore"`

	Show struct {
		Sales     bool `mapstructure:"sales"`
		Mints     bool `mapstructure:"mints"`
		Transfers bool `mapstructure:"transfers"`
		Listings  bool `mapstructure:"listings"`
	} `mapstructure:"show"`

	Highlight struct {
		Color              lipgloss.Color `mapstructure:"color"`
		Sales              lipgloss.Color `mapstructure:"show.sales"`
		Mints              lipgloss.Color `mapstructure:"mints"`
		Transfers          lipgloss.Color `mapstructure:"transfers"`
		Listings           lipgloss.Color `mapstructure:"listings.enabled"`
		ListingsBelowPrice float64        `mapstructure:"listings_below_price"`
	}

	//
	// calculated/generated fields
	Metadata *models.CollectionMetadata `mapstructure:"metadata"`

	Source models.CollectionSource `mapstructure:"source"`

	Colors struct {
		Primary   lipgloss.Color `mapstructure:"primary"`
		Secondary lipgloss.Color `mapstructure:"secondary"`
	} `mapstructure:"colors"`

	Counters struct {
		Sales       uint64
		Mints       uint64
		Transfers   uint64
		Listings    uint64
		SalesVolume *big.Int
	}

	SaLiRa ewma.MovingAverage `json:"salira"`

	FloorPrice         *ewma.MovingAverage `mapstructure:"floorPrice"`
	PreviousFloorPrice float64             `mapstructure:"previousFloorPrice"`
}

GbCollection represents the collections configured by the user.

func NewCollection

func NewCollection(contractAddress common.Address, name string, nodes *nodes.Nodes, source models.CollectionSource) *GbCollection

func (*GbCollection) AddMint

func (uc *GbCollection) AddMint()

func (*GbCollection) AddSale

func (uc *GbCollection) AddSale(value *big.Int, numItems uint64) float64

func (*GbCollection) CalculateFloorPrice added in v0.2.0

func (uc *GbCollection) CalculateFloorPrice(tokenPrice float64) (float64, float64)

CalculateFloorPrice updates the moving average of a given collection.

func (*GbCollection) CalculateSaLiRa

func (uc *GbCollection) CalculateSaLiRa(address common.Address) (float64, float64)

CalculateSaLiRa updates the salira moving average of a given collection.

func (*GbCollection) Render

func (uc *GbCollection) Render(text string) string

func (*GbCollection) ResetStats

func (uc *GbCollection) ResetStats()

func (*GbCollection) Style

func (uc *GbCollection) Style() lipgloss.Style

func (*GbCollection) StyleSecondary

func (uc *GbCollection) StyleSecondary() lipgloss.Style

type PushEvent added in v0.2.0

type PushEvent struct {
	NodeID          int
	EventType       EventType
	Topic           string
	TxHash          common.Hash
	CollectionName  string
	ContractAddress common.Address
	TokenID         *big.Int
	ENSMetadata     *external.ENSMetadata
	PriceWei        *big.Int
	PricePerItem    *big.Int
	CollectionColor lipgloss.Color
	Permalink       string
	TxItemCount     uint64
	Time            time.Time
	From            User
	FromENS         string
	To              User
	ToENS           string
}

type User

type User struct {
	Address       common.Address
	OpenseaUserID string
}

Jump to

Keyboard shortcuts

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