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#

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#

Referendum.CreateOrganizationInput#

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#

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#

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#

acs3.OrganizationWhiteListChanged#

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#

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#

acs3.OrganizationHashAddressPair#

acs3.OrganizationThresholdChanged#

acs3.OrganizationWhiteListChanged#

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

acs3.ProposalCreated#

acs3.ProposalOutput#

acs3.ProposalReleaseThreshold#

acs3.ProposalReleased#

acs3.ProposerWhiteList#

acs3.ReceiptCreated#

acs3.ValidateProposerInWhiteListInput#

AElf.Types#

aelf.Address#

aelf.BinaryMerkleTree#

aelf.Hash#

aelf.LogEvent#

aelf.MerklePath#

aelf.MerklePathNode#

aelf.SInt32Value#

aelf.SInt64Value#

aelf.ScopedStatePath#

aelf.SmartContractRegistration#

aelf.StatePath#

aelf.Transaction#

aelf.TransactionExecutingStateSet#

aelf.TransactionExecutingStateSet.DeletesEntry#

aelf.TransactionExecutingStateSet.ReadsEntry#

aelf.TransactionExecutingStateSet.WritesEntry#

aelf.TransactionResult#

aelf.TransactionResultStatus#

AuthorityInfo#

Edited on: 14 July 2024 05:03:34 GMT+0