mapper

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	GOV        = "gov"
	Proposals  = "proposals"
	Proposal   = "proposal"
	Votes      = "votes"
	Vote       = "vote"
	Deposits   = "deposits"
	Deposit    = "deposit"
	TallyQuery = "tally"
	ParamsPath = "params"
)

nolint

View Source
const (
	MapperName = "governance"
)

Variables

This section is empty.

Functions

func BuildQueryDepositPath

func BuildQueryDepositPath(pid uint64, depositAddr string) string

nolint

func BuildQueryDepositsPath

func BuildQueryDepositsPath(pid uint64) string

nolint

func BuildQueryModuleParamsPath

func BuildQueryModuleParamsPath(module string) string

nolint

func BuildQueryParamPath

func BuildQueryParamPath(module string, key string) string

nolint

func BuildQueryParamsPath

func BuildQueryParamsPath() string

nolint

func BuildQueryProposalPath

func BuildQueryProposalPath(pid uint64) string

nolint

func BuildQueryProposalsPath

func BuildQueryProposalsPath() string

nolint

func BuildQueryTallyPath

func BuildQueryTallyPath(pid uint64) string

nolint

func BuildQueryVotePath

func BuildQueryVotePath(pid uint64, voterAddr string) string

nolint

func BuildQueryVotesPath

func BuildQueryVotesPath(pid uint64) string

nolint

func DepositInvariant

func DepositInvariant(module string) qtypes.Invariant

func Query

func Query(ctx context.Context, route []string, req abci.RequestQuery) (res []byte, err btypes.Error)

nolint

func Tally

func Tally(ctx context.Context, mapper *Mapper, proposal gtypes.Proposal) (passes gtypes.ProposalResult, tallyResults gtypes.TallyResult, validators map[string]bool, deductOption gtypes.DeductOption)

Types

type Mapper

type Mapper struct {
	*mapper.BaseMapper
}

func GetMapper

func GetMapper(ctx context.Context) *Mapper

func NewMapper

func NewMapper() *Mapper

func (Mapper) ActiveProposalQueueIterator

func (mapper Mapper) ActiveProposalQueueIterator(endTime time.Time) store.Iterator

Returns an iterator for all the proposals in the Active Queue that expire by endTime

func (Mapper) AddDeposit

func (mapper Mapper) AddDeposit(ctx context.Context, proposalID uint64, depositorAddr btypes.Address, depositAmount uint64) (btypes.Error, bool)

Adds or updates a deposit of a specific depositor on a specific proposal Activates voting period when appropriate

func (Mapper) AddVote

func (mapper Mapper) AddVote(proposalID uint64, voterAddr btypes.Address, option types.VoteOption) btypes.Error

Adds a vote on a specific proposal

func (*Mapper) Copy

func (mapper *Mapper) Copy() mapper.IMapper

func (Mapper) DeleteDeposits

func (mapper Mapper) DeleteDeposits(ctx context.Context, proposalID uint64)

Deletes all the deposits on a specific proposal without refunding them

func (Mapper) DeleteProposal

func (mapper Mapper) DeleteProposal(proposalID uint64)

Delete proposal

func (Mapper) DeleteValidatorSet

func (mapper Mapper) DeleteValidatorSet(proposalID uint64)

func (Mapper) DeleteVotes

func (mapper Mapper) DeleteVotes(proposalID uint64)

Delete votes

func (Mapper) GetDeposit

func (mapper Mapper) GetDeposit(proposalID uint64, depositorAddr btypes.Address) (deposit types.Deposit, exists bool)

Gets the deposit of a specific depositor on a specific proposal

func (Mapper) GetDeposits

func (mapper Mapper) GetDeposits(proposalID uint64) store.Iterator

Gets all the deposits on a specific proposal as an sdk.Iterator

func (Mapper) GetLastProposalID

func (mapper Mapper) GetLastProposalID() (proposalID uint64)

Get the last used proposal ID

func (Mapper) GetParams

func (mapper Mapper) GetParams(ctx context.Context) types.Params

func (Mapper) GetProposal

func (mapper Mapper) GetProposal(proposalID uint64) (proposal types.Proposal, ok bool)

Get Proposal from store by ProposalID

func (Mapper) GetProposals

func (mapper Mapper) GetProposals() []types.Proposal

func (Mapper) GetProposalsFiltered

func (mapper Mapper) GetProposalsFiltered(ctx context.Context, voterAddr btypes.Address, depositorAddr btypes.Address, status types.ProposalStatus, numLatest uint64) []types.Proposal

Get Proposal from store by ProposalID voterAddr will filter proposals by whether or not that address has voted on them depositorAddr will filter proposals by whether or not that address has deposited to them status will filter proposals by status numLatest will fetch a specified number of the most recent proposals, or 0 for all proposals

func (Mapper) GetValidatorSet

func (mapper Mapper) GetValidatorSet(proposalID uint64) (validators []btypes.Address, exists bool)

func (Mapper) GetVote

func (mapper Mapper) GetVote(proposalID uint64, voterAddr btypes.Address) (vote types.Vote, exists bool)

Gets the vote of a specific voter on a specific proposal

func (Mapper) GetVotes

func (mapper Mapper) GetVotes(proposalID uint64) store.Iterator

Gets all the votes on a specific proposal

func (Mapper) InactiveProposalQueueIterator

func (mapper Mapper) InactiveProposalQueueIterator(endTime time.Time) store.Iterator

Returns an iterator for all the proposals in the Inactive Queue that expire by endTime

func (Mapper) InsertActiveProposalQueue

func (mapper Mapper) InsertActiveProposalQueue(endTime time.Time, proposalID uint64)

Inserts a ProposalID into the active proposal queue at endTime

func (Mapper) InsertInactiveProposalQueue

func (mapper Mapper) InsertInactiveProposalQueue(endTime time.Time, proposalID uint64)

Inserts a ProposalID into the inactive proposal queue at endTime

func (Mapper) PeekCurrentProposalID

func (mapper Mapper) PeekCurrentProposalID() (proposalID uint64, err btypes.Error)

Peeks the next available ProposalID without incrementing it

func (Mapper) RefundDeposits

func (mapper Mapper) RefundDeposits(ctx context.Context, proposalID uint64, deductDeposit bool)

Refunds and deletes all the deposits on a specific proposal

func (Mapper) RemoveFromActiveProposalQueue

func (mapper Mapper) RemoveFromActiveProposalQueue(endTime time.Time, proposalID uint64)

removes a proposalID from the Active Proposal Queue

func (Mapper) RemoveFromInactiveProposalQueue

func (mapper Mapper) RemoveFromInactiveProposalQueue(endTime time.Time, proposalID uint64)

removes a proposalID from the Inactive Proposal Queue

func (Mapper) SetDeposit

func (mapper Mapper) SetDeposit(proposalID uint64, depositorAddr btypes.Address, deposit types.Deposit)

func (Mapper) SetInitialProposalID

func (mapper Mapper) SetInitialProposalID(proposalID uint64) btypes.Error

Set the initial proposal ID

func (Mapper) SetParams

func (mapper Mapper) SetParams(ctx context.Context, p types.Params)

func (Mapper) SetProposal

func (mapper Mapper) SetProposal(proposal types.Proposal)

Update proposal

func (Mapper) SetVote

func (mapper Mapper) SetVote(proposalID uint64, voterAddr btypes.Address, vote types.Vote)

func (Mapper) SubmitProposal

func (mapper Mapper) SubmitProposal(ctx context.Context, content types.ProposalContent) (proposal types.Proposal, err btypes.Error)

Submit proposal

type QueryProposalsParam

type QueryProposalsParam struct {
	Depositor btypes.Address       `json:"depositor"`
	Voter     btypes.Address       `json:"voter"`
	Status    types.ProposalStatus `json:"status"`
	Limit     uint64               `json:"limit"`
}

nolint

Jump to

Keyboard shortcuts

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