logo

Vote Contract

The Vote contract is an abstract layer for voting. Developers implement concrete voting activities by calling this contract. Implements aelf Standards ACS1.

Contract Methods#

Method NameRequest TypeResponse TypeDescription
RegisterVote.VotingRegisterInputgoogle.protobuf.Empty <#google.protobuf.Empty>Create a voting activity.
VoteVote.VoteInputgoogle.protobuf.Empty <#google.protobuf.Empty>After successfully creating a voting activity, others are able to vote.
WithdrawVote.WithdrawInputgoogle.protobuf.Empty <#google.protobuf.Empty>A voter can withdraw the token after the lock time.
TakeSnapshotVote.TakeSnapshotInputgoogle.protobuf.Empty <#google.protobuf.Empty>Save the result of the specified number of votes and generates a new round of votes.
AddOptionVote.AddOptionInputgoogle.protobuf.Empty <#google.protobuf.Empty>Add an option to a voting activity.
RemoveOptionVote.RemoveOptionInputgoogle.protobuf.Empty <#google.protobuf.Empty>Remove an option from a voting activity.
AddOptionsVote.AddOptionsInputgoogle.protobuf.Empty <#google.protobuf.Empty>Add multiple options to a voting activity.
RemoveOptionsVote.RemoveOptionsInputgoogle.protobuf.Empty <#google.protobuf.Empty>Remove multiple options from a voting activity.
GetVotingItemVote.GetVotingItemInputVote.VotingItemGet a voting activity information.
GetVotingResultVote.GetVotingResultInputVote.VotingResultGet a voting result according to the provided voting activity id and snapshot number.
GetLatestVotingResultaelf.HashVote.VotingResultGets the latest result according to the voting activity id.
GetVotingRecordaelf.HashVote.VotingRecordGet the voting record according to vote id.
GetVotingRecordsVote.GetVotingRecordsInputVote.VotingRecords <#Vote.VotingRecords>Get the voting record according to vote ids.
GetVotedItemsaelf.AddressVote.VotedItems <#Vote.VotedItems>Get all voted information according to voter address.
GetVotingIdsVote.GetVotingIdsInputVote.VotedIdsGet the vote ids according to voting activity id.

AElf.Standards.ACS1#

Method NameRequest TypeResponse TypeDescription
SetMethodFeeacs1.MethodFeesgoogle.protobuf.EmptySet the method fees for the specified method. Note that this will override all fees of the method.
ChangeMethodFeeControllerAuthorityInfogoogle.protobuf.EmptyChange the method fee controller, the default is parliament and default organization.
GetMethodFeegoogle.protobuf.StringValueacs1.MethodFeesQuery method fee information by method name.
GetMethodFeeControllergoogle.protobuf.EmptyAuthorityInfoQuery the method fee controller.

Contract Types

AElf.Contracts.Vote#

Vote.AddOptionInput#

FieldTypeDescriptionLabel
voting_item_idaelf.HashThe voting activity id.
optionstringThe new option to add.

Vote.AddOptionsInput#

FieldTypeDescriptionLabel
voting_item_idaelf.HashThe voting activity id.
optionsstringThe new options to add.repeated

Vote.GetVotingIdsInput#

FieldTypeDescriptionLabel
voteraelf.AddressThe address of voter.
voting_item_idaelf.HashThe voting activity id.

Vote.GetVotingItemInput#

FieldTypeDescriptionLabel
voting_item_idaelf.HashThe voting activity id.

Vote.GetVotingRecordsInput#

FieldTypeDescriptionLabel
idsaelf.HashThe vote ids.repeated

Vote.GetVotingResultInput#

FieldTypeDescriptionLabel
voting_item_idaelf.HashThe voting activity id.
snapshot_numberint64The snapshot number.

Vote.RemoveOptionInput#

FieldTypeDescriptionLabel
voting_item_idaelf.HashThe voting activity id.
optionstringThe option to remove.

Vote.RemoveOptionsInput#

FieldTypeDescriptionLabel
voting_item_idaelf.HashThe voting activity id.
optionsstringThe options to remove.repeated

Vote.TakeSnapshotInput#

FieldTypeDescriptionLabel
voting_item_idaelf.HashThe voting activity id.
snapshot_numberint64The snapshot number to take.

Vote.VoteInput#

FieldTypeDescriptionLabel
voting_item_idaelf.HashThe voting activity id.
voteraelf.AddressThe address of voter.
amountint64The amount of vote.
optionstringThe option to vote.
vote_idaelf.HashThe vote id.
is_change_targetboolWhether vote others.

Vote.Voted#

FieldTypeDescriptionLabel
voting_item_idaelf.HashThe voting activity id.
voteraelf.AddressThe address of voter.
snapshot_numberint64The snapshot number.
amountint64The amount of vote.
vote_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The time of vote.
optionstringThe option voted.
vote_idaelf.HashThe vote id.

Vote.VotedIds#

FieldTypeDescriptionLabel
active_votesaelf.HashThe active vote ids.repeated
withdrawn_votesaelf.HashThe withdrawn vote ids.repeated

Vote.VotedItems#

FieldTypeDescriptionLabel
voted_item_vote_idsVotedItems.VotedItemVoteIdsEntryThe voted ids.repeated

Vote.VotedItems.VotedItemVoteIdsEntry#

FieldTypeDescriptionLabel
keystring
valueVotedIds

Vote.VotingItem#

FieldTypeDescriptionLabel
voting_item_idaelf.HashThe voting activity id.
accepted_currencystringThe token symbol which will be accepted.
is_lock_tokenboolWhether the vote will lock token.
current_snapshot_numberint64The current snapshot number.
total_snapshot_numberint64The total snapshot number.
optionsstringThe list of options.repeated
register_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The register time of the voting activity.
start_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The start time of the voting.
end_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The end time of the voting.
current_snapshot_start_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The start time of current round of the voting.
sponsoraelf.AddressThe sponsor address of the voting activity.

Vote.VotingItemRegistered#

FieldTypeDescriptionLabel
voting_item_idaelf.HashThe voting activity id.
accepted_currencystringThe token symbol which will be accepted.
is_lock_tokenboolWhether the vote will lock token.
current_snapshot_numberint64The current snapshot number.
total_snapshot_numberint64The total number of snapshots of the vote.
register_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The register time of the voting activity.
start_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The start time of the voting.
end_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The end time of the voting.
current_snapshot_start_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The start time of current round of the voting.
sponsoraelf.AddressThe sponsor address of the voting activity.

Vote.VotingRecord#

FieldTypeDescriptionLabel
voting_item_idaelf.HashThe voting activity id.
voteraelf.AddressThe address of voter.
snapshot_numberint64The snapshot number.
amountint64The amount of vote.
withdraw_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The time of withdraw.
vote_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The time of vote.
is_withdrawnboolWhether the vote had been withdrawn.
optionstringThe option voted.
is_change_targetboolWhether vote others.

Vote.VotingRecords#

FieldTypeDescriptionLabel
recordsVotingRecordThe voting records.repeated

Vote.VotingRegisterInput#

FieldTypeDescriptionLabel
start_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The start time of the voting.
end_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The end time of the voting.
accepted_currencystringThe token symbol which will be accepted.
is_lock_tokenboolWhether the vote will lock token.
total_snapshot_numberint64The total number of snapshots of the vote.
optionsstringThe list of options.repeated

Vote.VotingResult#

FieldTypeDescriptionLabel
voting_item_idaelf.HashThe voting activity id.
resultsVotingResult.ResultsEntryThe voting result, option -> amount of votes,repeated
snapshot_numberint64The snapshot number.
voters_countint64The total number of voters.
snapshot_start_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The start time of this snapshot.
snapshot_end_timestampgoogle.protobuf.Timestamp <#google.protobuf.Timestamp>The end time of this snapshot.
votes_amountint64Total votes received during the process of this snapshot.

Vote.VotingResult.ResultsEntry#

FieldTypeDescriptionLabel
keystring
valueint64

Vote.WithdrawInput#

FieldTypeDescriptionLabel
vote_idaelf.HashThe vote id.

Vote.Withdrawn#

FieldTypeDescriptionLabel
vote_idaelf.HashThe vote id.

AElf.Standards.ACS1#

acs1.MethodFee#

FieldTypeDescriptionLabel
symbolstringThe token symbol of the method fee.
basic_feeint64The amount of fees to be charged.

acs1.MethodFees#

FieldTypeDescriptionLabel
method_namestringThe name of the method to be charged.
feesMethodFeeList of fees to be charged.repeated
is_size_fee_freeboolOptional based on the implementation of SetMethodFee method.

AElf.Types#

aelf.Address#

FieldTypeDescriptionLabel
valuebytes

aelf.BinaryMerkleTree#

FieldTypeDescriptionLabel
nodesHashThe leaf nodes.repeated
rootHashThe root node hash.
leaf_countint32The count of leaf node.

aelf.Hash#

FieldTypeDescriptionLabel
valuebytes

aelf.LogEvent#

FieldTypeDescriptionLabel
addressAddressThe contract address.
namestringThe name of the log event.
indexedbytesThe indexed data.repeated
non_indexedbytesThe non indexed data.

aelf.MerklePath#

FieldTypeDescriptionLabel
merkle_path_nodesMerklePathNodeThe merkle path nodes.repeated

aelf.MerklePathNode#

FieldTypeDescriptionLabel
hashHashThe node hash.
is_left_child_nodeboolWhether it is a left child node.

aelf.SInt32Value#

FieldTypeDescriptionLabel
valuesint32

aelf.SInt64Value#

FieldTypeDescriptionLabel
valuesint64

aelf.ScopedStatePath#

FieldTypeDescriptionLabel
addressAddressThe scope address, which will be the contract address.
pathStatePath <#aelf.StatePath>The path of contract state.

aelf.SmartContractRegistration#

FieldTypeDescriptionLabel
categorysint32The category of contract code(0: C#).
codebytesThe byte array of the contract code.
code_hashHashThe hash of the contract code.
is_system_contractboolWhether it is a system contract.
versionint32The version of the current contract.

aelf.StatePath#

FieldTypeDescriptionLabel
partsstringThe partial path of the state path.repeated

aelf.Transaction#

FieldTypeDescriptionLabel
fromAddressThe address of the sender of the transaction.
toAddressThe address of the contract when calling a contract.
ref_block_numberint64The height of the referenced block hash.
ref_block_prefixbytesThe first four bytes of the referenced block hash.
method_namestringThe name of a method in the smart contract at the To address.
paramsbytesThe parameters to pass to the smart contract method.
signaturebytesWhen signing a transaction it’s actually a subset of the fields: from/to and the target method as well as the parameter that were given.

aelf.TransactionExecutingStateSet.DeletesEntry#

FieldTypeDescriptionLabel
keystring
valuebool

aelf.TransactionExecutingStateSet.ReadsEntry#

FieldTypeDescriptionLabel
keystring
valuebool

aelf.TransactionExecutingStateSet.WritesEntry#

FieldTypeDescriptionLabel
keystring
valuebytes

aelf.TransactionResult#

FieldTypeDescriptionLabel
transaction_idHashThe transaction id.
statusTransactionResultStatusThe transaction result status.
logsLogEventThe log events.repeated
bloombytesBloom filter for transaction logs.
return_valuebytesThe return value of the transaction execution.
block_numberint64 **The height of the block that packages the transaction.
block_hashHash **The hash of the block that packages the transaction.
errorstringFailed execution error message.

aelf.TransactionResultStatus#

NameNumberDescription
NOT_EXISTEDThe execution result of the transaction does not exist.
PENDING1The transaction is in the transaction pool waiting to be packaged.
FAILED2Transaction execution failed.
MINED3The transaction was successfully executed and successfully packaged into a block.
CONFLICT4When executed in parallel, there are conflicts with other transactions.
PENDING_VALIDATION5The transaction is waiting for validation.
NODE_VALIDATION_FAILED6Transaction validation failed.

AuthorityInfo#

FieldTypeDescriptionLabel
contract_addressaelf.AddressThe contract address of the controller.
owner_addressaelf.AddressThe address of the owner of the contract.

Edited on: 16 July 2024 05:49:32 GMT+0