Skip to main content

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_requiredbool Setting this to true can allow anyone to create proposals.
parliament_member_proposing_allowedbool Setting 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_requiredbool The setting indicates if proposals need authority to be created for first/default parliament organization.

Parliament.Organization

FieldTypeDescriptionLabel
proposer_authority_requiredbool Indicates 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_allowedbool Indicates 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_namestring The method that this proposal will call when being released.
to_addressaelf.AddressThe address of the target contract.
paramsbytes The parameters of the release transaction.
expired_timegoogle.protobuf.Timestamp The 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_urlstring Url is used for proposal describing.

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 of SetMethodFee method.

AElf.Standards.ACS3

acs3.CreateProposalBySystemContractInput

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

acs3.CreateProposalInput

FieldTypeDescriptionLabel
contract_method_namestring The name of the method to call after release.
to_addressaelf.AddressThe address of the contract to call after release.
paramsbytes The parameters of the method to be called after the release.
expired_timegoogle.protobuf.Timestamp The timestamp at which this proposal will expire.
organization_addressaelf.AddressThe address of the organization.
proposal_description_urlstring URL 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_listProposerWhiteList The 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_namestring The method that this proposal will call when being released.
to_addressaelf.AddressThe 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.AddressThe address of this proposals organization.
proposeraelf.AddressThe 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.

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_typestring The type of receipt
timegoogle.protobuf.Timestamp The 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_countint32 The count of leaf node.

aelf.Hash

FieldTypeDescriptionLabel
valuebytes

aelf.LogEvent

FieldTypeDescriptionLabel
addressAddressThe contract address.
namestring The name of the log event.
indexedbytes The indexed data, used to calculate bloom.repeated
non_indexedbytes The non indexed data.

aelf.MerklePath

FieldTypeDescriptionLabel
merkle_path_nodesMerklePathNode The merkle path nodes.repeated

aelf.MerklePathNode

FieldTypeDescriptionLabel
hashHashThe node hash.
is_left_child_nodebool Whether 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.
pathStatePath The path of contract state.

aelf.SmartContractRegistration

FieldTypeDescriptionLabel
categorysint32 The 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
bloombytes 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_valuebytes The 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_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.AddressThe contract address of the controller.
owner_addressaelf.AddressThe address of the owner of the contract.