Documentation ¶
Index ¶
- Variables
- type Bucket
- type Indexer
- func (s *Indexer) Bucket(id uint64, height uint64) (*VoteBucket, bool, error)
- func (s *Indexer) Buckets(height uint64) ([]*VoteBucket, error)
- func (s *Indexer) BucketsByCandidate(candidate address.Address, height uint64) ([]*VoteBucket, error)
- func (s *Indexer) BucketsByIndices(indices []uint64, height uint64) ([]*VoteBucket, error)
- func (s *Indexer) ContractAddress() string
- func (s *Indexer) DeleteTipBlock(context.Context, *block.Block) error
- func (s *Indexer) Height() (uint64, error)
- func (s *Indexer) PutBlock(ctx context.Context, blk *block.Block) error
- func (s *Indexer) Start(ctx context.Context) error
- func (s *Indexer) StartHeight() uint64
- func (s *Indexer) Stop(ctx context.Context) error
- func (s *Indexer) TotalBucketCount(height uint64) (uint64, error)
- type StakingIndexer
- type VoteBucket
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBucketNotExist is the error when bucket does not exist ErrBucketNotExist = errors.New("bucket does not exist") )
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct { Candidate address.Address Owner address.Address StakedAmount *big.Int StakedDurationBlockNumber uint64 CreatedAt uint64 UnlockedAt uint64 UnstakedAt uint64 }
func (*Bucket) Deserialize ¶
Deserialize deserializes the bucket info
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer is the staking indexer
func NewIndexer ¶
func NewIndexer(kvstore db.KVStore, contractAddr string, startHeight uint64, blockInterval time.Duration) *Indexer
NewIndexer creates a new staking indexer
func (*Indexer) Buckets ¶
func (s *Indexer) Buckets(height uint64) ([]*VoteBucket, error)
Buckets returns the buckets
func (*Indexer) BucketsByCandidate ¶
func (s *Indexer) BucketsByCandidate(candidate address.Address, height uint64) ([]*VoteBucket, error)
BucketsByCandidate returns the buckets by candidate
func (*Indexer) BucketsByIndices ¶
func (s *Indexer) BucketsByIndices(indices []uint64, height uint64) ([]*VoteBucket, error)
BucketsByIndices returns the buckets by indices
func (*Indexer) ContractAddress ¶
ContractAddress returns the contract address
func (*Indexer) DeleteTipBlock ¶
DeleteTipBlock deletes the tip block from indexer
func (*Indexer) StartHeight ¶
StartHeight returns the start height of the indexer
type StakingIndexer ¶
type StakingIndexer interface { lifecycle.StartStopper Height() (uint64, error) StartHeight() uint64 ContractAddress() string Buckets(height uint64) ([]*VoteBucket, error) Bucket(id uint64, height uint64) (*VoteBucket, bool, error) BucketsByIndices(indices []uint64, height uint64) ([]*VoteBucket, error) BucketsByCandidate(candidate address.Address, height uint64) ([]*VoteBucket, error) TotalBucketCount(height uint64) (uint64, error) PutBlock(ctx context.Context, blk *block.Block) error DeleteTipBlock(ctx context.Context, blk *block.Block) error }
StakingIndexer defines the interface of staking indexer
type VoteBucket ¶
type VoteBucket = staking.VoteBucket
Click to show internal directories.
Click to hide internal directories.