Skip to main content

Referendum

Production nodes or associations cannot determine all decisions. Some extremely important decisions, especially those involving user rights and interests, should involve all users and give full control to the user's voting for governance. The Referendum contract is built for this.

Implement aelf Standards ACS1 and ACS3.

Contract Methods

Method NameRequest TypeResponse TypeDescription
ReclaimVoteTokenaelf.Hash google.protobuf.Empty Unlock the token used for voting according to proposal id.
CreateOrganizationReferendum.CreateOrganizationInput aelf.Address Create an organization and return its address.
CreateOrganizationBySystemContractReferendum.CreateOrganizationBySystemContractInput aelf.Address Creates an organization by system contract and return its address.
GetOrganizationaelf.Address Referendum.Organization Get the organization according to the organization address.
CalculateOrganizationAddressReferendum.CreateOrganizationInput aelf.Address Calculate the input and return the organization address.
GetProposalVirtualAddressaelf.Hash aelf.Address Get the virtual address of a proposal based on the proposal id.

AElf.Standards.ACS1

Method NameRequest TypeResponse TypeDescription
SetMethodFeeacs1.MethodFees google.protobuf.Empty Set the method fees for the specified method. Note that this will override all fees of the method.
ChangeMethodFeeControllerAuthorityInfo google.protobuf.Empty Change the method fee controller, the default is parliament and default organization.
GetMethodFeegoogle.protobuf.StringValue acs1.MethodFees Query method fee information by method name.
GetMethodFeeControllergoogle.protobuf.Empty AuthorityInfo Query the method fee controller.

AElf.Standards.ACS3

Method NameRequest TypeResponse TypeDescription
CreateProposalacs3.CreateProposalInput aelf.Hash Create a proposal for which organization members can vote. When the proposal is released, a transaction will be sent to the specified contract. Return id of the newly created proposal.
Approveaelf.Hash google.protobuf.Empty Approve a proposal according to the proposal ID.
Rejectaelf.Hash google.protobuf.Empty Reject a proposal according to the proposal ID.
Abstainaelf.Hash google.protobuf.Empty Abstain a proposal according to the proposal ID.
Releaseaelf.Hash google.protobuf.Empty Release a proposal according to the proposal ID and send a transaction to the specified contract.
ChangeOrganizationThresholdacs3.ProposalReleaseThreshold google.protobuf.Empty Change the thresholds associated with proposals. All fields will be overwritten by the input value and this will affect all current proposals of the organization. Note: only the organization can execute this through a proposal.
ChangeOrganizationProposerWhiteListacs3.ProposerWhiteList google.protobuf.Empty Change the white list of organization proposer. This method overrides the list of whitelisted proposers.
CreateProposalBySystemContractacs3.CreateProposalBySystemContractInput aelf.Hash Create a proposal by system contracts, and return id of the newly created proposal.
ClearProposalaelf.Hash google.protobuf.Empty Remove the specified proposal. If the proposal is in effect, the cleanup fails.
GetProposalaelf.Hash acs3.ProposalOutput Get the proposal according to the proposal ID.
ValidateOrganizationExistaelf.Address google.protobuf.BoolValue Check the existence of an organization.
ValidateProposerInWhiteListacs3.ValidateProposerInWhiteListInput google.protobuf.BoolValue Check if the proposer is whitelisted.

Contract Types

AElf.Contracts.Referendum

Referendum.CreateOrganizationBySystemContractInput

FieldTypeDescriptionLabel
organization_creation_inputCreateOrganizationInput The parameters of creating organization.
organization_address_feedback_methodstring The organization address callback method which replies the organization address to caller contract.

Referendum.CreateOrganizationInput

FieldTypeDescriptionLabel
token_symbolstringThe token used during proposal operations.
proposal_release_thresholdacs3.ProposalReleaseThresholdThe threshold for releasing the proposal.
proposer_white_listacs3.ProposerWhiteListThe proposer whitelist.
creation_tokenaelf.HashThe creation token is for organization address generation.

Referendum.Organization

FieldTypeDescriptionLabel
proposal_release_thresholdacs3.ProposalReleaseThresholdThe threshold for releasing the proposal.
token_symbolstringThe token used during proposal operations.
organization_addressaelf.AddressThe address of organization.
organization_hashaelf.HashThe organization's id.
proposer_white_listacs3.ProposerWhiteListThe proposer whitelist.
creation_tokenaelf.HashThe creation token is for organization address generation.

Referendum.ProposalInfo

FieldTypeDescriptionLabel
proposal_idaelf.HashThe proposal ID.
contract_method_namestringThe method that this proposal will call when being released.
to_addressaelf.AddressThe address of the target contract.
paramsbytesThe parameters of the release transaction.
expired_timegoogle.protobuf.TimestampThe date at which this proposal will expire.
proposeraelf.AddressThe address of the proposer of this proposal.
organization_addressaelf.AddressThe address of this proposal's organization.
approval_countint64The count of approved.
rejection_countint64The count of rejected.
abstention_countint64The count of abstained.
proposal_description_urlstringURL used for proposal describing.

Referendum.Receipt

FieldTypeDescriptionLabel
amountint64The amount of token locked.
token_symbolstringThe symbol of token locked.
lock_idaelf.HashThe lock ID.

Referendum.ReferendumReceiptCreated

FieldTypeDescriptionLabel
proposal_idaelf.HashThe ID of the proposal.
addressaelf.AddressThe sender address.
symbolstringThe symbol of token locked.
amountint64The amount of token locked.
receipt_typestringThe type of receipt (Approve, Reject, or Abstain).
timegoogle.protobuf.TimestampThe timestamp of this method call.
organization_addressaelf.AddressThe address of the organization.

AElf.Standards.ACS1

acs1.MethodFee

FieldTypeDescriptionLabel
symbolstring The token symbol of the method fee.
basic_feeint64 The amount of fees to be charged.

acs1.MethodFees

FieldTypeDescriptionLabel
method_namestring The name of the method to be charged.
feesMethodFee List of fees to be charged.repeated
is_size_fee_freebool Optional based on the implementation.

AElf.Standards.ACS3

acs3.CreateProposalBySystemContractInput

FieldTypeDescriptionLabel
proposal_inputCreateProposalInput The parameters of creating proposal.
origin_proposeraelf.Address The actor that triggers the call.

acs3.CreateProposalInput

FieldTypeDescriptionLabel
contract_method_namestring The name of the method to call after release.
to_addressaelf.Address The address of the contract to call after release.
paramsbytes The parameter of the method to be called after the release.
expired_timegoogle.protobuf.Timestamp The timestamp at which this proposal will expire.
organization_addressaelf.Address The address of the organization.
proposal_description_urlstring URL used for proposal description.
tokenaelf.Hash The token for proposal ID generation.

acs3.OrganizationCreated

FieldTypeDescriptionLabel
organization_addressaelf.Address The address of the created organization.

acs3.OrganizationHashAddressPair

FieldTypeDescriptionLabel
organization_hashaelf.Hash The ID of the organization.
organization_addressaelf.Address The address of organization.

acs3.OrganizationThresholdChanged

FieldTypeDescriptionLabel
organization_addressaelf.Address The organization address
proposer_release_thresholdProposalReleaseThreshold The new release threshold.

acs3.OrganizationWhiteListChanged

FieldTypeDescriptionLabel
organization_addressaelf.Address The organization address.
proposer_white_listProposerWhiteList The new proposer whitelist.

acs3.ProposalCreated

FieldTypeDescriptionLabel
proposal_idaelf.Hash The ID of the created proposal.
organization_addressaelf.Address The organization address of the created proposal.

acs3.ProposalOutput

FieldTypeDescriptionLabel
proposal_idaelf.Hash The ID of the proposal.
contract_method_namestring The method that this proposal will call when being released.
to_addressaelf.Address The address of the target contract.
paramsbytes The parameters of the release transaction.
expired_timegoogle.protobuf.Timestamp The date at which this proposal will expire.
organization_addressaelf.Address The address of this proposal's organization.
proposeraelf.Address The address of the proposer of this proposal.
to_be_releasedbool Indicates if this proposal is releasable.
approval_countint64 Approval count for this proposal.
rejection_countint64 Rejection count for this proposal.
abstention_countint64 Abstention count for this proposal.

acs3.ProposalReleaseThreshold

FieldTypeDescriptionLabel
minimal_approval_thresholdint64 The value for the minimum approval threshold.
maximal_rejection_thresholdint64 The value for the maximal rejection threshold.
maximal_abstention_thresholdint64 The value for the maximal abstention threshold.
minimal_vote_thresholdint64 The value for the minimal vote threshold.

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.

AElf.Standards.ACS3

acs3.CreateProposalBySystemContractInput

FieldTypeDescriptionLabel
proposal_inputCreateProposalInputThe parameters of creating proposal.
origin_proposeraelf.AddressThe actor that triggers the call.

acs3.CreateProposalInput

FieldTypeDescriptionLabel
contract_method_namestringThe name of the method to call after release.
to_addressaelf.AddressThe address of the contract to call after release.
paramsbytesThe parameter of the method to be called after the release.
expired_timegoogle.protobuf.TimestampThe timestamp at which this proposal will expire.
organization_addressaelf.AddressThe address of the organization.
proposal_description_urlstringURL used for proposal description.
tokenaelf.HashThe token for proposal ID generation.

acs3.OrganizationCreated

FieldTypeDescriptionLabel
organization_addressaelf.AddressThe address of the created organization.

acs3.OrganizationHashAddressPair

FieldTypeDescriptionLabel
organization_hashaelf.HashThe ID of organization.
organization_addressaelf.AddressThe address of organization.

acs3.OrganizationThresholdChanged

FieldTypeDescriptionLabel
organization_addressaelf.AddressThe organization address
proposer_release_thresholdProposalReleaseThresholdThe new release threshold.

acs3.OrganizationWhiteListChanged

FieldTypeDescriptionLabel
organization_addressaelf.AddressThe organization address.
proposer_white_listProposerWhiteListThe new proposer whitelist.

acs3.ProposalCreated

FieldTypeDescriptionLabel
proposal_idaelf.HashThe ID of the created proposal.
organization_addressaelf.AddressThe organization address.

acs3.ProposalOutput

FieldTypeDescriptionLabel
proposal_idaelf.HashThe ID of the proposal.
contract_method_namestringThe method that this proposal will call when being released.
to_addressaelf.AddressThe address of the target contract.
paramsbytesThe parameters of the release transaction.
expired_timegoogle.protobuf.TimestampThe date at which this proposal will expire.
organization_addressaelf.AddressThe address of this proposal's organization.
proposeraelf.AddressThe address of the proposer of this proposal.
to_be_releasedboolIndicates if this proposal is releasable.
approval_countint64Approval count for this proposal.
rejection_countint64Rejection count for this proposal.
abstention_countint64Abstention count for this proposal.

acs3.ProposalReleaseThreshold

FieldTypeDescriptionLabel
minimal_approval_thresholdint64The value for the minimum approval threshold.
maximal_rejection_thresholdint64The value for the maximal rejection threshold.
maximal_abstention_thresholdint64The value for the maximal abstention threshold.
minimal_vote_thresholdint64The value for the minimal vote threshold.

acs3.ProposalReleased

FieldTypeDescriptionLabel
proposal_idaelf.HashThe id of the released proposal.
organization_addressaelf.AddressThe organization address of the released proposal.

acs3.ProposerWhiteList

FieldTypeDescriptionLabel
proposersaelf.AddressThe address of the proposersrepeated

acs3.ReceiptCreated

FieldTypeDescriptionLabel
proposal_idaelf.HashThe id of the proposal.
addressaelf.AddressThe sender address.
receipt_typestringThe type of receipt (Approve, Reject, or Abstain).
timegoogle.protobuf.TimestampThe timestamp of this method call.
organization_addressaelf.AddressThe address of the organization.

acs3.ValidateProposerInWhiteListInput

FieldTypeDescriptionLabel
proposeraelf.AddressThe address to search/check.
organization_addressaelf.AddressThe address of the organization.

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.
pathStatePathThe path of contract state.

aelf.SmartContractRegistration

FieldTypeDescriptionLabel
categorysint32 The category of contract code(0: C#).
codebytes The byte array of the contract code.
code_hashHash The hash of the contract code.
is_system_contractbool Whether it is a system contract.
versionint32 The version of the current contract.

aelf.StatePath

FieldTypeDescriptionLabel
partsstring The partial path of the state path.repeated

aelf.Transaction

FieldTypeDescriptionLabel
fromAddress The address of the sender of the transaction.
toAddress The address of the contract when calling a contract.
ref_block_numberint64 The height of the referenced block hash.
ref_block_prefixbytes The first four bytes of the referenced block hash.
method_namestring The name of a method in the smart contract at the To address.
paramsbytes The parameters to pass to the smart contract method.
signaturebytes When signing a transaction it’s actually a subset of the fields.

aelf.TransactionExecutingStateSet

FieldTypeDescriptionLabel
writesTransactionExecutingStateSet.WritesEntry The changed states.repeated
readsTransactionExecutingStateSet.ReadsEntry The read states.repeated
deletesTransactionExecutingStateSet.DeletesEntry The deleted states.repeated

aelf.TransactionExecutingStateSet.DeletesEntry

FieldTypeDescriptionLabel
keystring
valuebool

aelf.TransactionExecutingStateSet.ReadsEntry

FieldTypeDescriptionLabel
keystring
valuebool

aelf.TransactionExecutingStateSet.WritesEntry

FieldTypeDescriptionLabel
keystring
valuebytes

aelf.TransactionResult

FieldTypeDescriptionLabel
transaction_idHash The transaction id.
statusTransactionResultStatus The transaction result status.
logsLogEvent The log events.repeated
bloombytes Bloom filter for transaction logs.
return_valuebytes The return value of the transaction execution.
block_numberint64 The height of the block hat packages the transaction.
block_hashHash The hash of the block hat packages the transaction.
errorstring Failed execution error message.

aelf.TransactionResultStatus

NameNumberDescription
NOT_EXISTED0The 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.Address The contract address of the controller.
owner_addressaelf.Address The address of the owner of the contract.