logo

Parliament Contract

The production nodes use the Parliament contract to govern important matters. In the initial state, the production nodes are members of the parliament, and only when two-thirds of the production nodes vote in favor of a given decision, will it be executed.

Implement aelf Standards ACS1 and ACS3.

Contract Methods#

Method NameRequest TypeResponse TypeDescription
InitializeParliament.InitializeInputgoogle.protobuf.EmptyInitialize parliament proposer whitelist and create the first parliament organization with specific proposer_authority_required.
CreateOrganizationParliament.CreateOrganizationInputaelf.AddressCreate an organization and return its address.
ApproveMultiProposalsParliament.ProposalIdListgoogle.protobuf.EmptyBatch approval proposal.
CreateOrganizationBySystemContractParliament.CreateOrganizationBySystemContractInputaelf.AddressCreates an organization by system contract and return its address.
GetOrganizationaelf.AddressParliament.OrganizationGet the organization according to the organization address.
GetDefaultOrganizationAddressgoogle.protobuf.Emptyaelf.AddressGet the default organization address.
ValidateAddressIsParliamentMemberaelf.Addressgoogle.protobuf.BoolValueValidates if the provided address is a parliament member.
GetProposerWhiteListgoogle.protobuf.Emptyacs3.ProposerWhiteListReturns the list of whitelisted proposers.
GetNotVotedPendingProposalsParliament.ProposalIdListParliament.ProposalIdListFilter still pending ones not yet voted by the sender from provided proposals.
GetNotVotedProposalsParliament.ProposalIdListParliament.ProposalIdListFilter not yet voted ones by the sender from provided proposals.
CalculateOrganizationAddressParliament.CreateOrganizationInputaelf.AddressCalculates with input and return the organization address.
GetReleaseThresholdReachedProposalsParliament.ProposalIdListParliament.ProposalIdListFilter reached release threshold proposals.
GetAvailableProposalsParliament.ProposalIdListParliament.ProposalIdListFilter available proposals.

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

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

Parliament.CreateOrganizationInput#

FieldTypeDescriptionLabel
proposal_release_thresholdacs3.ProposalReleaseThresholdThe threshold for releasing the proposal.
proposer_authority_requiredboolSetting this to true can allow anyone to create proposals.
parliament_member_proposing_allowedboolSetting this to true can allow parliament member to create proposals.
creation_tokenaelf.HashThe creation token is for organization address generation.

Parliament.InitializeInput#

FieldTypeDescriptionLabel
privileged_proposeraelf.AddressPrivileged proposer would be the first address in parliament proposer whitelist.
proposer_authority_requiredboolThe setting indicates if proposals need authority to be created for first/default parliament organization.

Parliament.Organization#

FieldTypeDescriptionLabel
proposer_authority_requiredboolIndicates if proposals need authority to be created.
organization_addressaelf.AddressThe organization address.
organization_hashaelf.HashThe organization id.
proposal_release_thresholdacs3.ProposalReleaseThresholdThe threshold for releasing the proposal.
parliament_member_proposing_allowedboolIndicates if parliament member can propose to this organization.
creation_tokenaelf.HashThe creation token is for organization address generation.

Parliament.ProposalIdList#

FieldTypeDescriptionLabel
proposal_idsaelf.HashThe list of proposal ids.repeated

Parliament.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 proposals organization.
approvalsaelf.AddressAddress list of approved.repeated
rejectionsaelf.AddressAddress list of rejected.repeated
abstentionsaelf.AddressAddress list of abstained.repeated
proposal_description_urlstringUrl is used for proposal describing.

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.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 parameters 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 and calculation.

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 the 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 proposals 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
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, used to calculate bloom.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.
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: 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#

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. 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_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: 14 July 2024 05:05:02 GMT+0