collections

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: MIT Imports: 17 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 CollectionSource

type CollectionSource int64
const (
	Configuration CollectionSource = iota
	Wallet
	Stream
)

type Collections

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

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

func New

func New() *Collections

func (*Collections) Addresses

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

func (*Collections) ListingsAddresses

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

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

func (*Collections) OpenseaSlugs

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

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

func (*Collections) SortedAndColoredNames

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

func (*Collections) UserCollectionsAddresses

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

type Event

type Event struct {
	EventType EventType
	Topic     string
	TxHash    common.Hash
	// Collection      *Collection
	Collection      *GbCollection
	TokenID         uint64
	PriceWei        *big.Int
	PricePerItem    *big.Int
	CollectionColor lipgloss.Color
	// MultiItemTx bool
	Permalink   string
	TxItemCount uint
	Time        time.Time
	From        User
	FromENS     string
	To          User
	ToENS       string
	WorkerID    int
}

type EventType

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

func (EventType) ActionName

func (dt EventType) ActionName() string

func (EventType) Icon

func (dt EventType) Icon() string

type GbCollection

type GbCollection struct {
	ContractAddress common.Address `mapstructure:"address"`
	Name            string         `mapstructure:"name"`

	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:"show.listings"`
		ListingsBelowPrice float64        `mapstructure:"listings_below_price"`
	}

	Metadata *gbnode.CollectionMetadata `mapstructure:"metadata"`

	Source CollectionSource `mapstructure:"source"`

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

	Counters struct {
		Sales       uint64   `mapstructure:"sales"`
		Mints       uint64   `mapstructure:"mints"`
		Transfers   uint64   `mapstructure:"transfers"`
		Listings    uint64   `mapstructure:"listings"`
		SalesVolume *big.Int `mapstructure:"salesVolume"`
	} `mapstructure:"counters"`

	SaLiRa ewma.MovingAverage `mapstructure:"salira"`

	// exponential moving average of the actuall sale prices
	ArtificialFloor         ewma.MovingAverage `mapstructure:"artificialFloor"`
	PreviousArtificialFloor float64            `mapstructure:"artificialFloor"`
}

GbCollection represents the collections configured by the user.

func GetCollectionsFromConfiguration

func GetCollectionsFromConfiguration(nodes *gbnode.NodeCollection) []*GbCollection

func NewCollection

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

func (*GbCollection) AddMint

func (uc *GbCollection) AddMint()

func (*GbCollection) AddSale

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

func (*GbCollection) CalculateArtificialFloor

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

CalculateMovingAverage updates the moving average of a given collection.

func (*GbCollection) CalculateSaLiRa

func (uc *GbCollection) CalculateSaLiRa() (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) SaLiRaAdd

func (uc *GbCollection) SaLiRaAdd() float64

func (*GbCollection) Style

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

func (*GbCollection) StyleSecondary

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

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