degendb

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortMapByValue added in v0.8.0

func SortMapByValue(m map[string]int64, reverse bool) []string

func WriteDataToFile added in v0.8.0

func WriteDataToFile(data interface{}, filePath string)

func ZstdCompress added in v0.8.0

func ZstdCompress(in io.Reader, out io.Writer) error

Types

type Accounts

type Accounts struct {
	// Twitter is the Twitter username for this degen
	Twitter string `bson:"twitter,omitempty" json:"twitter"`

	// Telegram is the Telegram username for this degen
	Telegram string `bson:"telegram,omitempty" json:"telegram"`

	// ChatID is the Telegram chat ID for this degen
	TelegramChatID int64 `bson:"telegram_chat_id,omitempty" json:"telegram_chat_id"`
}

type Collection

type Collection struct {
	// ID is the unique identifier for this collection
	ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`

	// Address is the address of the contract
	Address common.Address `bson:"address,omitempty" json:"address,omitempty"`

	// Name is the name of the collection
	Name string `bson:"name,omitempty" json:"name,omitempty"`

	// Slugs are the collection slugs of the collection
	Slugs Slugs `bson:"slugs,omitempty" json:"slugs,omitempty"`

	// Description is the description of the collection
	Description string `bson:"description,omitempty" json:"description,omitempty"`

	// TotalSupply is the total supply of the collection
	TotalSupply int `bson:"total_supply,omitempty" json:"total_supply,omitempty"`

	// ImageURL is the URL of the image of the collection
	ImageURL string `bson:"image_url,omitempty" json:"image_url,omitempty"`

	// ExternalURL is the URL of the collection
	ExternalURL string `bson:"external_url,omitempty" json:"external_url,omitempty"`

	// CreatedAt is the time this collection was created
	CreatedAt time.Time `bson:"created_at,omitempty" json:"created_at,omitempty"`
	// UpdatedAt is the time this collection was last updated
	UpdatedAt time.Time `bson:"updated_at,omitempty" json:"updated_at,omitempty"`
}

type Degen

type Degen struct {
	// ID is the unique identifier for this degen
	ID primitive.ObjectID `bson:"_id,omitempty" json:"id"`

	// Name is the name of the degen
	Name string `bson:"name,omitempty" json:"name"`

	// Accounts contains other accounts of this degen
	Accounts Accounts `bson:"accounts,omitempty" json:"accounts"`

	// Wallets is a list of wallet addresses associated with this degen
	Wallets []Wallet `bson:"wallets,omitempty" json:"wallets"`

	// Tags is a list of tags associated with this degen
	Tags []Tag `bson:"tags,omitempty" json:"tags"`

	// CreatedAt is the time this degen was created
	CreatedAt time.Time `bson:"created_at,omitempty" json:"created_at"`

	// UpdatedAt is the time this degen was last updated
	UpdatedAt time.Time `bson:"updated_at,omitempty" json:"updated_at"`
}

type DegenDB

type DegenDB struct {
	// contains filtered or unexported fields
}

func NewDegenDB

func NewDegenDB() *DegenDB

func (*DegenDB) AddCollectionToken

func (ddb *DegenDB) AddCollectionToken(collections interface{}, tokens interface{})

type EventType added in v0.9.0

type EventType int
const (
	Sale EventType = iota
	Mint
	Listing

	AcceptedOffer
	AcceptedCollectionOffer
)

func (EventType) String added in v0.9.0

func (et EventType) String() string

type MetadataAttribute added in v0.8.0

type MetadataAttribute struct {
	// Name is the name of the attribute
	Name string `json:"name"`

	// Value is the value of the attribute
	// Value interface{} `json:"value"`
	Value string `json:"value"`

	// Data type of the attribute
	TraitType string `json:"-"`
}

type OpenSeaMetadata added in v0.8.0

type OpenSeaMetadata []struct {
	TokenIdentifier struct {
		ContractAddress string `json:"contract_address"`
		TokenID         int64  `json:"token_id"`
	} `json:"token_identifier"`
	MetadataDict  map[string]interface{} `json:"metadata_dict"`
	TokenStandard string                 `json:"token_standard"`
	Slug          string                 `json:"slug"`
}

type OpenSeaRanks added in v0.8.0

type OpenSeaRanks map[int64]TokenRank

type ParsedEvent added in v0.10.0

type ParsedEvent struct {
	TxHash                 common.Hash
	Action                 string
	ReceivedAt             string
	TimeColor              lipgloss.Color
	Typemoji               string
	Price                  string
	PriceColor             lipgloss.Color
	PriceCurrencyColor     lipgloss.Color
	PriceArrowColor        lipgloss.Color
	TransferredCollections []TransferredCollection
	BlurURL                string
	EtherscanURL           string
	OpenSeaURL             string

	// temporary until we have a better solution
	From      string
	FromColor lipgloss.Color
	To        string
	ToColor   lipgloss.Color
}

type Rank

type Rank struct {
	// OpenSea is the OpenSea rank of the token
	OpenSea int64 `bson:"opensea,omitempty" json:"opensea"`

	// Blur is the Blur rank of the token
	Blur int64 `bson:"blur,omitempty" json:"blur"`
}

type RecentEvent added in v0.9.0

type RecentEvent struct {
	Timestamp time.Time `bson:"timestamp,omitempty" json:"timestamp,omitempty"`

	// Event Type
	Type EventType `bson:"type,omitempty" json:"type,omitempty"`

	// Event Volume
	AmountWei    *big.Int `bson:"amount_wei,omitempty"    json:"amount_wei,omitempty"`
	AmountTokens uint64   `bson:"amount_tokens,omitempty" json:"amount_tokens,omitempty"`
}

type SaLiRa added in v0.9.0

type SaLiRa struct {
	ewma.MovingAverage
	Timeframe     time.Duration
	CountSales    int
	CountListings int
	Previous      float64
}

single SaLiRa instance.

func (*SaLiRa) Pretty added in v0.9.0

func (s *SaLiRa) Pretty() string

type SaLiRas added in v0.9.0

type SaLiRas []*SaLiRa

SaLiRas is a group of saLiRa instances for different timeframes type SaLiRas map[time.Duration]*saLiRa.

func NewSaLiRas added in v0.9.0

func NewSaLiRas(timeframes []time.Duration) SaLiRas

NewSaLiRas creates a new SaLiRas instance.

type Score added in v0.8.0

type Score struct {
	TokenID       int64   `json:"token_id"`
	Rank          int64   `json:"rank"`
	Score         float64 `json:"score"`
	TokenFeatures struct {
		UniqueAttributeCount int `json:"unique_attribute_count"`
	} `json:"token_features"`
	TokenMetadata map[string]interface{} `json:"token_metadata"`
}

type Slugs

type Slugs struct {
	// OpenSea is the OpenSea slug of the token
	OpenSea string `bson:"opensea,omitempty" json:"opensea"`

	// Blur is the Blur slug of the token
	Blur string `bson:"blur,omitempty" json:"blur"`
}

type Tag

type Tag string

type Token

type Token struct {
	// ID is the unique identifier for this token
	ID primitive.ObjectID `bson:"_id,omitempty" json:"id"`

	// Collection is the collection this token belongs to
	Collection Collection `bson:"collection,omitempty" json:"collection"`

	// CollectionSlugs are the collection slugs of the collection this token belongs to
	CollectionSlugs Slugs `bson:"collection_slugs,omitempty" json:"collection_slugs"`

	// ContractAddress is the address of the contract this token belongs to
	ContractAddress string `bson:"contract_address,omitempty" json:"contract_address"`

	// Token ID used as in the collection
	TokenID int64 `bson:"token_id,omitempty" json:"token_id"`

	// Name is the name of the token
	Name string `bson:"name,omitempty" json:"name"`

	// Ranks are the ranks of the token
	Rank Rank `bson:"ranks,omitempty" json:"ranks"`

	// Score is the score of the token calculated via the open-rarity algorithm
	Score float64 `bson:"score,omitempty" json:"score"`

	// Metadata is the metadata of the token
	Metadata []MetadataAttribute `bson:"metadata,omitempty" json:"metadata"`

	// CreatedAt is the time this token was created
	CreatedAt time.Time `bson:"created_at,omitempty" json:"created_at"`

	// UpdatedAt is the time this token was last updated
	UpdatedAt time.Time `bson:"updated_at,omitempty" json:"updated_at"`
}

type TokenMetadata added in v0.8.0

type TokenMetadata struct {
	Attributes      []MetadataAttribute `json:"-"`
	Name            string              `json:"name"`
	Description     string              `json:"description"`
	Image           string              `json:"image"`
	TokenID         int64               `json:"token_id"`
	ContractAddress common.Address      `json:"-"`
	Score           Score               `json:"score,omitempty"`
}

type TokenRank added in v0.8.0

type TokenRank struct {
	Rank  int64   `json:"rank"`
	Score float64 `json:"score"`
}

func (TokenRank) GetRankSymbol added in v0.10.0

func (tr TokenRank) GetRankSymbol(totalSupply uint64) string

type TransferredCollection added in v0.10.0

type TransferredCollection struct {
	CollectionName    string
	TransferredTokens []TransferredToken

	PrimaryColor   lipgloss.Color
	SecondaryColor lipgloss.Color

	// from & to per collection as we print one line per collection...^^
	From string
	To   string
}

type TransferredToken added in v0.10.0

type TransferredToken struct {
	ID         int64
	Rank       int64
	RankSymbol string
	Amount     int64
}

type Wallet

type Wallet struct {
	// ID is the unique identifier for this wallet
	ID primitive.ObjectID `bson:"_id,omitempty" json:"id"`

	// Address is the wallet address
	Address common.Address `bson:"address" json:"address"`

	// Tags is a list of tags associated with this wallet
	Tags []Tag `bson:"tags,omitempty" json:"tags"`

	// LastSeen is the time this wallet was last seen
	LastSeen int64 `bson:"last_seen,omitempty" json:"last_seen"`

	// CreatedAt is the time this wallet was created
	CreatedAt int64 `bson:"created_at,omitempty" json:"created_at"`

	// UpdatedAt is the time this wallet was last updated
	UpdatedAt int64 `bson:"updated_at,omitempty" json:"updated_at"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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