AElf.Contracts.Vote
Vote contract.
The Vote contract is an abstract layer for voting. Developers implement concrete voting activities by calling this contract.
Implement AElf Standards ACS1.
Contract Methods
Method Name |
Request Type |
Response Type |
Description |
---|---|---|---|
Register |
Create a voting activity. |
||
Vote |
After successfully creating a voting activity, others are able to vote. |
||
Withdraw |
A voter can withdraw the token after the lock time. |
||
TakeSnapshot |
Save the result of the specified number of votes and generates a new round votes. |
||
AddOption |
Add an option to a voting activity. |
||
RemoveOption |
Remove an option from a voting activity. |
||
AddOptions |
Add multiple options to a voting activity. |
||
RemoveOptions |
Remove multiple options from a voting activity. |
||
GetVotingItem |
Get a voting activity information. |
||
GetVotingResult |
Get a voting result according to the provided voting activity id and snapshot number. |
||
GetLatestVotingResult |
Gets the latest result according to the voting activity id. |
||
GetVotingRecord |
Get the voting record according to vote id. |
||
GetVotingRecords |
Get the voting record according to vote ids. |
||
GetVotedItems |
Get all voted information according to voter address. |
||
GetVotingIds |
Get the vote ids according to voting activity id. |
AElf.Standards.ACS1
Method Name |
Request Type |
Response Type |
Description |
---|---|---|---|
SetMethodFee |
Set the method fees for the specified method. Note that this will override all fees of the method. |
||
ChangeMethodFeeController |
Change the method fee controller, the default is parliament and default organization. |
||
GetMethodFee |
Query method fee information by method name. |
||
GetMethodFeeController |
Query the method fee controller. |
Contract Types
AElf.Contracts.Vote
Vote.AddOptionInput
Field |
Type |
Description |
Label |
---|---|---|---|
voting_item_id |
The voting activity id. |
||
option |
The new option to add. |
Vote.AddOptionsInput
Field |
Type |
Description |
Label |
---|---|---|---|
voting_item_id |
The voting activity id. |
||
options |
The new options to add. |
repeated |
Vote.GetVotingIdsInput
Field |
Type |
Description |
Label |
---|---|---|---|
voter |
The address of voter. |
||
voting_item_id |
The voting activity id. |
Vote.GetVotingItemInput
Field |
Type |
Description |
Label |
---|---|---|---|
voting_item_id |
The voting activity id. |
Vote.GetVotingRecordsInput
Field |
Type |
Description |
Label |
---|---|---|---|
ids |
The vote ids. |
repeated |
Vote.GetVotingResultInput
Field |
Type |
Description |
Label |
---|---|---|---|
voting_item_id |
The voting activity id. |
||
snapshot_number |
The snapshot number. |
Vote.RemoveOptionInput
Field |
Type |
Description |
Label |
---|---|---|---|
voting_item_id |
The voting activity id. |
||
option |
The option to remove. |
Vote.RemoveOptionsInput
Field |
Type |
Description |
Label |
---|---|---|---|
voting_item_id |
The voting activity id. |
||
options |
The options to remove. |
repeated |
Vote.TakeSnapshotInput
Field |
Type |
Description |
Label |
---|---|---|---|
voting_item_id |
The voting activity id. |
||
snapshot_number |
The snapshot number to take. |
Vote.VoteInput
Field |
Type |
Description |
Label |
---|---|---|---|
voting_item_id |
The voting activity id. |
||
voter |
The address of voter. |
||
amount |
The amount of vote. |
||
option |
The option to vote. |
||
vote_id |
The vote id. |
||
is_change_target |
Whether vote others. |
Vote.Voted
Field |
Type |
Description |
Label |
---|---|---|---|
voting_item_id |
The voting activity id. |
||
voter |
The address of voter. |
||
snapshot_number |
The snapshot number. |
||
amount |
The amount of vote. |
||
vote_timestamp |
The time of vote. |
||
option |
The option voted. |
||
vote_id |
The vote id. |
Vote.VotedIds
Field |
Type |
Description |
Label |
---|---|---|---|
active_votes |
The active vote ids. |
repeated |
|
withdrawn_votes |
The withdrawn vote ids. |
repeated |
Vote.VotedItems
Field |
Type |
Description |
Label |
---|---|---|---|
voted_item_vote_ids |
The voted ids. |
repeated |
Vote.VotedItems.VotedItemVoteIdsEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
Vote.VotingItem
Field |
Type |
Description |
Label |
---|---|---|---|
voting_item_id |
The voting activity id. |
||
accepted_currency |
The token symbol which will be accepted. |
||
is_lock_token |
Whether the vote will lock token. |
||
current_snapshot_number |
The current snapshot number. |
||
total_snapshot_number |
The total snapshot number. |
||
options |
The list of options. |
repeated |
|
register_timestamp |
The register time of the voting activity. |
||
start_timestamp |
The start time of the voting. |
||
end_timestamp |
The end time of the voting. |
||
current_snapshot_start_timestamp |
The start time of current round of the voting. |
||
sponsor |
The sponsor address of the voting activity. |
Vote.VotingItemRegistered
Field |
Type |
Description |
Label |
---|---|---|---|
voting_item_id |
The voting activity id. |
||
accepted_currency |
The token symbol which will be accepted. |
||
is_lock_token |
Whether the vote will lock token. |
||
current_snapshot_number |
The current snapshot number. |
||
total_snapshot_number |
The total number of snapshots of the vote. |
||
register_timestamp |
The register time of the voting activity. |
||
start_timestamp |
The start time of the voting. |
||
end_timestamp |
The end time of the voting. |
||
current_snapshot_start_timestamp |
The start time of current round of the voting. |
||
sponsor |
The sponsor address of the voting activity. |
Vote.VotingRecord
Field |
Type |
Description |
Label |
---|---|---|---|
voting_item_id |
The voting activity id. |
||
voter |
The address of voter. |
||
snapshot_number |
The snapshot number. |
||
amount |
The amount of vote. |
||
withdraw_timestamp |
The time of withdraw. |
||
vote_timestamp |
The time of vote. |
||
is_withdrawn |
Whether the vote had been withdrawn. |
||
option |
The option voted. |
||
is_change_target |
Whether vote others. |
Vote.VotingRecords
Field |
Type |
Description |
Label |
---|---|---|---|
records |
The voting records. |
repeated |
Vote.VotingRegisterInput
Field |
Type |
Description |
Label |
---|---|---|---|
start_timestamp |
The start time of the voting. |
||
end_timestamp |
The end time of the voting. |
||
accepted_currency |
The token symbol which will be accepted. |
||
is_lock_token |
Whether the vote will lock token. |
||
total_snapshot_number |
The total number of snapshots of the vote. |
||
options |
The list of options. |
repeated |
Vote.VotingResult
Field |
Type |
Description |
Label |
---|---|---|---|
voting_item_id |
The voting activity id. |
||
results |
The voting result, option -> amount of votes, |
repeated |
|
snapshot_number |
The snapshot number. |
||
voters_count |
The total number of voters. |
||
snapshot_start_timestamp |
The start time of this snapshot. |
||
snapshot_end_timestamp |
The end time of this snapshot. |
||
votes_amount |
Total votes received during the process of this snapshot. |
Vote.VotingResult.ResultsEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
Vote.WithdrawInput
Field |
Type |
Description |
Label |
---|---|---|---|
vote_id |
The vote id. |
Vote.Withdrawn
Field |
Type |
Description |
Label |
---|---|---|---|
vote_id |
The vote id. |
AElf.Standards.ACS1
acs1.MethodFee
Field |
Type |
Description |
Label |
---|---|---|---|
symbol |
The token symbol of the method fee. |
||
basic_fee |
The amount of fees to be charged. |
acs1.MethodFees
Field |
Type |
Description |
Label |
---|---|---|---|
method_name |
The name of the method to be charged. |
||
fees |
List of fees to be charged. |
repeated |
|
is_size_fee_free |
Optional based on the implementation of SetMethodFee method. |
AElf.Types
aelf.Address
Field |
Type |
Description |
Label |
---|---|---|---|
value |
aelf.BinaryMerkleTree
Field |
Type |
Description |
Label |
---|---|---|---|
nodes |
The leaf nodes. |
repeated |
|
root |
The root node hash. |
||
leaf_count |
The count of leaf node. |
aelf.Hash
Field |
Type |
Description |
Label |
---|---|---|---|
value |
aelf.LogEvent
Field |
Type |
Description |
Label |
---|---|---|---|
address |
The contract address. |
||
name |
The name of the log event. |
||
indexed |
The indexed data, used to calculate bloom. |
repeated |
|
non_indexed |
The non indexed data. |
aelf.MerklePath
Field |
Type |
Description |
Label |
---|---|---|---|
merkle_path_nodes |
The merkle path nodes. |
repeated |
aelf.MerklePathNode
Field |
Type |
Description |
Label |
---|---|---|---|
hash |
The node hash. |
||
is_left_child_node |
Whether it is a left child node. |
aelf.SInt32Value
Field |
Type |
Description |
Label |
---|---|---|---|
value |
aelf.SInt64Value
Field |
Type |
Description |
Label |
---|---|---|---|
value |
aelf.ScopedStatePath
Field |
Type |
Description |
Label |
---|---|---|---|
address |
The scope address, which will be the contract address. |
||
path |
The path of contract state. |
aelf.SmartContractRegistration
Field |
Type |
Description |
Label |
---|---|---|---|
category |
The category of contract code(0: C#). |
||
code |
The byte array of the contract code. |
||
code_hash |
The hash of the contract code. |
||
is_system_contract |
Whether it is a system contract. |
||
version |
The version of the current contract. |
aelf.StatePath
Field |
Type |
Description |
Label |
---|---|---|---|
parts |
The partial path of the state path. |
repeated |
aelf.Transaction
Field |
Type |
Description |
Label |
---|---|---|---|
from |
The address of the sender of the transaction. |
||
to |
The address of the contract when calling a contract. |
||
ref_block_number |
The height of the referenced block hash. |
||
ref_block_prefix |
The first four bytes of the referenced block hash. |
||
method_name |
The name of a method in the smart contract at the To address. |
||
params |
The parameters to pass to the smart contract method. |
||
signature |
When 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. It also contains the reference block number and prefix. |
aelf.TransactionExecutingStateSet
Field |
Type |
Description |
Label |
---|---|---|---|
writes |
The changed states. |
repeated |
|
reads |
The read states. |
repeated |
|
deletes |
The deleted states. |
repeated |
aelf.TransactionExecutingStateSet.DeletesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
aelf.TransactionExecutingStateSet.ReadsEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
aelf.TransactionExecutingStateSet.WritesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
aelf.TransactionResult
Field |
Type |
Description |
Label |
---|---|---|---|
transaction_id |
The transaction id. |
||
status |
The transaction result status. |
||
logs |
The log events. |
repeated |
|
bloom |
Bloom filter for transaction logs. A transaction log event can be defined in the contract and stored in the bloom filter after the transaction is executed. Through this filter, we can quickly search for and determine whether a log exists in the transaction result. |
||
return_value |
The return value of the transaction execution. |
||
block_number |
The height of the block hat packages the transaction. |
||
block_hash |
The hash of the block hat packages the transaction. |
||
error |
Failed execution error message. |
aelf.TransactionResultStatus
Name |
Number |
Description |
---|---|---|
NOT_EXISTED |
0 |
The execution result of the transaction does not exist. |
PENDING |
1 |
The transaction is in the transaction pool waiting to be packaged. |
FAILED |
2 |
Transaction execution failed. |
MINED |
3 |
The transaction was successfully executed and successfully packaged into a block. |
CONFLICT |
4 |
When executed in parallel, there are conflicts with other transactions. |
PENDING_VALIDATION |
5 |
The transaction is waiting for validation. |
NODE_VALIDATION_FAILED |
6 |
Transaction validation failed. |