logo

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

acs10.Dividends#

FieldTypeDescriptionLabel
valueDividends.ValueEntryThe dividends, symbol -> amount.repeated

acs10.Dividends.ValueEntry#

FieldTypeDescriptionLabel
keystring
valueint64

acs10.DonateInput#

FieldTypeDescriptionLabel
symbolstringThe token symbol to donate.
amountint64The amount to donate.

acs10.DonationReceived#

FieldTypeDescriptionLabel
fromaelf.AddressThe address of donors.
pool_contractaelf.AddressThe address of dividend pool.
symbolstringThe token symbol Donated.
amountint64The amount Donated.

acs10.ReleaseInput#

FieldTypeDescriptionLabel
period_numberint64The period number to release.

acs10.SymbolList#

FieldTypeDescriptionLabel
valuestringThe token symbol list.repeated

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's 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.
return_valuebytesThe return value of the transaction execution.
block_numberint64The height of the block that packages the transaction.
block_hashHashThe hash of the block that 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 03:34:37 GMT+0