github.com/iotexproject/iotex-core@v1.14.1-rc1/action/protocol/staking/contractstake_indexer.go (about)

     1  // Copyright (c) 2023 IoTeX Foundation
     2  // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
     3  // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
     4  // This source code is governed by Apache License 2.0 that can be found in the LICENSE file.
     5  
     6  package staking
     7  
     8  import (
     9  	"context"
    10  	"math/big"
    11  
    12  	"github.com/iotexproject/iotex-address/address"
    13  )
    14  
    15  type (
    16  
    17  	// ContractStakingIndexer defines the interface of contract staking reader
    18  	ContractStakingIndexer interface {
    19  		// CandidateVotes returns the total staked votes of a candidate
    20  		// candidate identified by owner address
    21  		CandidateVotes(ctx context.Context, ownerAddr address.Address, height uint64) (*big.Int, error)
    22  		// Buckets returns active buckets
    23  		Buckets(height uint64) ([]*VoteBucket, error)
    24  		// BucketsByIndices returns active buckets by indices
    25  		BucketsByIndices([]uint64, uint64) ([]*VoteBucket, error)
    26  		// BucketsByCandidate returns active buckets by candidate
    27  		BucketsByCandidate(ownerAddr address.Address, height uint64) ([]*VoteBucket, error)
    28  		// TotalBucketCount returns the total number of buckets including burned buckets
    29  		TotalBucketCount(height uint64) (uint64, error)
    30  		// BucketTypes returns the active bucket types
    31  		BucketTypes(height uint64) ([]*ContractStakingBucketType, error)
    32  	}
    33  )