logo

Referendum Contract

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.Hashgoogle.protobuf.EmptyUnlock the token used for voting according to proposal id.
CreateOrganizationReferendum.CreateOrganizationInputaelf.AddressCreate an organization and return its address.
CreateOrganizationBySystemContractReferendum.CreateOrganizationBySystemContractInputaelf.AddressCreates an organization by system contract and return its address.
GetOrganizationaelf.AddressReferendum.OrganizationGet the organization according to the organization address.
CalculateOrganizationAddressReferendum.CreateOrganizationInputaelf.AddressCalculate the input and return the organization address.
GetProposalVirtualAddressaelf.Hashaelf.AddressGet the virtual address of a proposal based on the proposal 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.

AElf.Standards.ACS3#

Method NameRequest TypeResponse TypeDescription
CreateProposalacs3.CreateProposalInputaelf.HashCreate 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.Hashgoogle.protobuf.EmptyApprove a proposal according to the proposal ID.
Rejectaelf.Hashgoogle.protobuf.EmptyReject a proposal according to the proposal ID.
Abstainaelf.Hashgoogle.protobuf.EmptyAbstain a proposal according to the proposal ID.
Releaseaelf.Hashgoogle.protobuf.EmptyRelease a proposal according to the proposal ID and send a transaction to the specified contract.
ChangeOrganizationThresholdacs3.ProposalReleaseThresholdgoogle.protobuf.EmptyChange 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.ProposerWhiteListgoogle.protobuf.EmptyChange the white list of organization proposer. This method overrides the list of whitelisted proposers.
CreateProposalBySystemContractacs3.CreateProposalBySystemContractInputaelf.HashCreate a proposal by system contracts, and return id of the newly created proposal.
ClearProposalaelf.Hashgoogle.protobuf.EmptyRemove the specified proposal. If the proposal is in effect, the cleanup fails.
GetProposalaelf.Hashacs3.ProposalOutputGet the proposal according to the proposal ID.
ValidateOrganizationExistaelf.Addressgoogle.protobuf.BoolValueCheck the existence of an organization.
ValidateProposerInWhiteListacs3.ValidateProposerInWhiteListInputgoogle.protobuf.BoolValueCheck if the proposer is whitelisted.

Contract Types#

AElf.Contracts.Referendum#

Referendum.CreateOrganizationBySystemContractInput#

FieldTypeDescriptionLabel
organization_creation_inputCreateOrganizationInputThe parameters of creating organization.
organization_address_feedback_methodstringThe 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
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 the 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 of the created proposal.

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.

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
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.

aelf.TransactionExecutingStateSet#

FieldTypeDescriptionLabel
writesTransactionExecutingStateSet.WritesEntryThe changed states.repeated
readsTransactionExecutingStateSet.ReadsEntryThe read states.repeated
deletesTransactionExecutingStateSet.DeletesEntryThe 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_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_numberint64The height of the block hat packages the transaction.
block_hashHashThe hash of the block hat 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: 17 July 2024 04:48:35 GMT+0