Skip to main content

Treasury Contract

Used for distributing bonuses to voters and candidates during the election process. Implement aelf Standards ACS1 and ACS10.

Contract Methods

Method NameRequest TypeResponse TypeDescription
InitialTreasuryContractgoogle.protobuf.Emptygoogle.protobuf.EmptyInitialize treasury contract.
InitialMiningRewardProfitItemgoogle.protobuf.Emptygoogle.protobuf.EmptyInitialize the sub-item of the bonus scheme.
DonateAllTreasury.DonateAllInputgoogle.protobuf.EmptyDonate all tokens owned by the sender.
SetDividendPoolWeightSettingTreasury.DividendPoolWeightSettinggoogle.protobuf.EmptySet the dividend weight of the sub-item of the dividend item.
SetMinerRewardWeightSettingTreasury.MinerRewardWeightSettinggoogle.protobuf.EmptySet the miner reward weight.
SetProfitsReceiverTreasury.SetProfitsReceiverInputgoogle.protobuf.EmptySet collect profits receiver address.
UpdateMiningRewardgoogle.protobuf.Int64Valuegoogle.protobuf.EmptySet the reward for mining.
ChangeTreasuryControllerAuthorityInfogoogle.protobuf.EmptyChange the governance authority information for the treasury contract.
RecordMinerReplacementTreasury.RecordMinerReplacementInputgoogle.protobuf.EmptyAEDPoS Contract can notify Treasury Contract to be aware of miner replacement happening.
GetWelfareRewardAmountSampleTreasury.GetWelfareRewardAmountSampleInputTreasury.GetWelfareRewardAmountSampleOutputUsed to estimate the revenue weight of 10000 tokens voted by users.
GetTreasurySchemeIdgoogle.protobuf.Emptyaelf.HashGet the scheme id of treasury.
GetDividendPoolWeightProportiongoogle.protobuf.EmptyTreasury.DividendPoolWeightProportionQuery the weight percentage of dividend pool items.
GetMinerRewardWeightProportiongoogle.protobuf.EmptyTreasury.MinerRewardWeightProportionQuery the weight percentage of the dividend item for miners.
GetTreasuryControllergoogle.protobuf.EmptyAuthorityInfoQuery the governance authority information.
GetProfitsReceivergoogle.protobuf.StringValueaelf.AddressGet profits receiver. If not set, return the candidate's address.
GetProfitsReceiverOrDefaultgoogle.protobuf.StringValueaelf.AddressGet profits receiver. If not set, return null.
ReplaceCandidateProfitsReceiverTreasury.ReplaceCandidateProfitsReceiverInputgoogle.protobuf.EmptyQuery the governance authority information.

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

Method NameRequest TypeResponse TypeDescription
Donateacs10.DonateInputgoogle.protobuf.EmptyDonates tokens from the caller to the treasury. If the tokens are not native tokens in the current chain, they will be first converted to the native token.
Releaseacs10.ReleaseInputgoogle.protobuf.EmptyRelease dividend pool according to the period number.
SetSymbolListacs10.SymbolListgoogle.protobuf.EmptySet the token symbols dividend pool supports.
GetSymbolListgoogle.protobuf.Emptyacs10.SymbolListQuery the token symbols dividend pool supports.
GetUndistributedDividendsgoogle.protobuf.Emptyacs10.DividendsQuery the balance of undistributed tokens whose symbols are included in the symbol list.
GetDividendsgoogle.protobuf.Int64Valueacs10.DividendsQuery the dividend information according to the height.

Contract Types

AElf.Contracts.Treasury

Treasury.DividendPoolWeightProportion

FieldTypeDescriptionLabel
citizen_welfare_proportion_infoSchemeProportionInfoThe proportion of citizen welfare.
backup_subsidy_proportion_infoSchemeProportionInfoThe proportion of candidate nodes.
miner_reward_proportion_infoSchemeProportionInfoThe proportion of miner

Treasury.DividendPoolWeightSetting

FieldTypeDescriptionLabel
citizen_welfare_weightint32The dividend weight of citizen welfare.
backup_subsidy_weightint32The dividend weight of candidate nodes.
miner_reward_weightint32The dividend weight of miner.

Treasury.DonateAllInput

FieldTypeDescriptionLabel
symbolstringThe token symbol to donate.

Treasury.GetWelfareRewardAmountSampleInput

FieldTypeDescriptionLabel
valueint64Token lock time.repeated

Treasury.GetWelfareRewardAmountSampleOutput

FieldTypeDescriptionLabel
valueint64The weight calculated.repeated

Treasury.MinerReElectionInformation

FieldTypeDescriptionLabel
continual_appointment_timesMinerReElectionInformation.ContinualAppointmentTimesEntryThe reappointment information for miner.repeated

Treasury.MinerReElectionInformation.ContinualAppointmentTimesEntry

FieldTypeDescriptionLabel
keystring
valueint64

Treasury.MinerRewardWeightProportion

FieldTypeDescriptionLabel
basic_miner_reward_proportion_infoSchemeProportionInfoThe proportion of the basic income of the miner.
votes_weight_reward_proportion_infoSchemeProportionInfoThe proportion of the vote of the miner.
re_election_reward_proportion_infoSchemeProportionInfoThe proportion of the reappointment of the miner.

Treasury.MinerRewardWeightSetting

FieldTypeDescriptionLabel
basic_miner_reward_weightint32The dividend weight of the basic income of the miner.
votes_weight_reward_weightint32The dividend weight of the vote of the miner.
re_election_reward_weightint32The dividend weight of the reappointment of the miner.

Treasury.RecordMinerReplacementInput

FieldTypeDescriptionLabel
old_pubkeystring
new_pubkeystring
current_term_numberint64

Treasury.SchemeProportionInfo

FieldTypeDescriptionLabel
scheme_idaelf.HashThe scheme id.
proportionint32Dividend weight percentage.

Treasury.SetProfitsReceiverInput

FieldTypeDescriptionLabel
pubkeystringThe candidate's public key.
profits_receiver_addressaelf.HashThe address of profits receiver.

Treasury.ReplaceCandidateProfitsReceiverInput

FieldTypeDescriptionLabel
old_pubkeystringThe old candidate's public key.
new_pubkeystringThe new candidate's public key.

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

acs10.Dividends

FieldTypeDescriptionLabel
valueDividends.ValueEntry The dividends, symbol -> amount.repeated

acs10.Dividends.ValueEntry

FieldTypeDescriptionLabel
keystring
valueint64

acs10.DonateInput

FieldTypeDescriptionLabel
symbolstring The token symbol to donate.
amountint64 The amount to donate.

acs10.DonationReceived

FieldTypeDescriptionLabel
fromaelf.Address The address of donors.
pool_contractaelf.Address The address of dividend pool.
symbolstring The token symbol Donated.
amountint64 The amount Donated.

acs10.ReleaseInput

FieldTypeDescriptionLabel
period_numberint64 The period number to release.

acs10.SymbolList

FieldTypeDescriptionLabel
valuestring The token symbol list.repeated

AElf.Types

aelf.Address

FieldTypeDescriptionLabel
valuebytes

aelf.BinaryMerkleTree

FieldTypeDescriptionLabel
nodesHash The leaf nodes.repeated
rootHash The root node hash.
leaf_countint32 The count of leaf node.

aelf.Hash

FieldTypeDescriptionLabel
valuebytes

aelf.LogEvent

FieldTypeDescriptionLabel
addressAddress The 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
hashHash The node hash.
is_left_child_nodebool Whether it's a left child node.

aelf.SInt32Value

FieldTypeDescriptionLabel
valuesint32

aelf.SInt64Value

FieldTypeDescriptionLabel
valuesint64

aelf.ScopedStatePath

FieldTypeDescriptionLabel
addressAddress The 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#).
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: 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.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. A transaction log event can be defined in the contract and stored in the bloom filter after the transaction is executed.
return_valuebytes The return value of the transaction execution.
block_numberint64 The height of the block that packages the transaction.
block_hashHash The hash of the block that 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.