delegates

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

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

func NewConsumer

func NewConsumer(nc *nats.Conn, s *Service) (*Consumer, error)

func (*Consumer) Start

func (c *Consumer) Start(ctx context.Context) error

type DaoProvider

type DaoProvider interface {
	GetIDByOriginalID(string) (uuid.UUID, error)
}

type DelegationDetails

type DelegationDetails struct {
	Address string
	Weight  int
}

type Delegations

type Delegations struct {
	Details    []DelegationDetails
	Expiration int
}

type History

type History struct {
	Action          string
	AddressFrom     string
	OriginalSpaceID string
	ChainID         string
	BlockNumber     int
	BlockTimestamp  int
	Delegations     Delegations `gorm:"-"`
	Payload         json.RawMessage
}

History storing delegate actions history

func (History) TableName

func (History) TableName() string

type Proposal added in v0.2.4

type Proposal struct {
	ID            string
	OriginalDaoID string
	Author        string
}

type Publisher added in v0.2.4

type Publisher interface {
	PublishJSON(ctx context.Context, subject string, obj any) error
}

type Repo

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

func NewRepo

func NewRepo(db *gorm.DB) *Repo

func (*Repo) CallInTx

func (r *Repo) CallInTx(cb func(tx *gorm.DB) error) error

func (*Repo) CreateHistory

func (r *Repo) CreateHistory(tx *gorm.DB, dd History) error

CreateHistory creates one history info

func (*Repo) CreateSummary

func (r *Repo) CreateSummary(sm Summary) error

CreateSummary creates one summary info

func (*Repo) FindDelegator added in v0.2.4

func (r *Repo) FindDelegator(daoID, author string) (*Summary, error)

func (*Repo) GetSummaryBlockTimestamp

func (r *Repo) GetSummaryBlockTimestamp(tx *gorm.DB, addressFrom, daoID string) (int, error)

func (*Repo) RemoveSummary

func (r *Repo) RemoveSummary(tx *gorm.DB, addressFrom, daoID string) error

func (*Repo) UpdateSummaryExpiration

func (r *Repo) UpdateSummaryExpiration(tx *gorm.DB, addressFrom, daoID string, expiration, blockTimestamp int) error

type Service

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

func NewService

func NewService(repo *Repo, dp DaoProvider, p Publisher) *Service

type Summary

type Summary struct {
	AddressFrom        string
	AddressTo          string
	DaoID              string
	Weight             int
	LastBlockTimestamp int
	ExpiresAt          int64
	CreatedAt          time.Time
}

func (*Summary) Expired added in v0.2.4

func (s *Summary) Expired() bool

func (*Summary) SelfDelegation added in v0.2.4

func (s *Summary) SelfDelegation() bool

func (Summary) TableName

func (Summary) TableName() string

Jump to

Keyboard shortcuts

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