data

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StatusWaiting = "waiting"
	StatusStarted = "started"
	StatusEnded   = "ended"
)

The statuses that can be in the voting

Functions

This section is empty.

Types

type ProcessedEvent added in v0.4.0

type ProcessedEvent struct {
	TransactionHash []byte    `db:"transaction_hash"`
	LogIndex        int64     `db:"log_index"`
	CreatedAt       time.Time `db:"created_at"`
	BlockNumber     int64     `db:"block_number"`
}

type ProcessedEventQ added in v0.5.0

type ProcessedEventQ interface {
	New() ProcessedEventQ

	InsertProcessedEvent(value ProcessedEvent) error

	GetLastBlock() (uint64, error)
	CheckProcessedEventExist(value ProcessedEvent) (bool, error)
}

type SortOrder

type SortOrder string
const (
	ASC  SortOrder = "ASC"
	DESC SortOrder = "DESC"
)

type State

type State struct {
	ID        string `db:"id" structs:"-"`
	Root      string `db:"root" structs:"root"`
	TxHash    string `db:"tx_hash" structs:"tx_hash"`
	Block     uint64 `db:"block" structs:"block"`
	Timestamp uint64 `db:"timestamp" structs:"timestamp"`
}

type StateQ

type StateQ interface {
	New() StateQ

	Get() (*State, error)
	Upsert(data State) error

	FilterByRoot(root ...string) StateQ
	FilterByBlock(block ...uint64) StateQ

	SortByBlockHeight(order SortOrder) StateQ
}

type VotingInfo added in v0.4.0

type VotingInfo struct {
	VotingId                        int64                                     `db:"voting_id"`
	Balance                         *big.Int                                  `db:"residual_balance"` // Residual voting balance. It changes both during deposits and vote processing
	GasLimit                        uint64                                    `db:"gas_limit"`
	CreatorAddress                  string                                    `db:"creator_address"`
	ParsedWhiteListDataWithMetadata resources.ParsedWhiteListDataWithMetadata `db:"parsed_whitelist_data_with_metadata"`
	TotalBalance                    *big.Int                                  `db:"total_balance"` // The balance that corresponds to the initial balance with the addition of all deposits
	MinAge                          int64                                     `db:"min_age"`
	MaxAge                          int64                                     `db:"max_age"`
	StartTimestamp                  int64                                     `db:"start_timestamp"`
	EndTimestamp                    int64                                     `db:"end_timestamp"`
	VotesCount                      int64                                     `db:"votes_count"`
	Status                          string                                    `db:"status"`
}

This structure contains the basic data about the voting (also referred to here as a proposal).

type VotingQ added in v0.5.0

type VotingQ interface {
	New() VotingQ

	Update(fields map[string]any) error
	InsertVotingInfo(value *VotingInfo) error
	UpdateVotingInfo(value *VotingInfo) error

	Get(column string, dest interface{}) error
	GetVotingBalance() (*big.Int, *big.Int, error)
	GetVotingInfo(votingId int64) (*VotingInfo, error)
	SelectVotingInfo() ([]*VotingInfo, error)

	FilterByVotingId(votingIds ...int64) VotingQ
	FilterByCreator(creators ...string) VotingQ
	FilterBySex(sexList ...string) VotingQ
	FilterByMinAge(minAgeList ...int64) VotingQ
	FilterByMaxAge(maxAgeList ...int64) VotingQ
	FilterBySatus(statusList ...string) VotingQ
	WithStatus() VotingQ

	FilterByCitizenship(сitizenshipList ...string) VotingQ
	Page(page *pgdb.OffsetPageParams) VotingQ
}

type VotingWhitelistDataBigInt added in v0.5.0

type VotingWhitelistDataBigInt struct {
	Selector                            *big.Int   `json:"selector"`
	CitizenshipWhitelist                []*big.Int `json:"citizenshipWhitelist"`
	IdentityCreationTimestampUpperBound *big.Int   `json:"identityCreationTimestampUpperBound"`
	IdentityCounterUpperBound           *big.Int   `json:"identityCounterUpperBound"`
	Sex                                 *big.Int   `json:"sex"`
	BirthDateLowerbound                 *big.Int   `json:"birthDateLowerbound"`
	BirthDateUpperbound                 *big.Int   `json:"birthDateUpperbound"`
	ExpirationDateLowerBound            *big.Int   `json:"expirationDateLowerBound"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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