Skip to main content

TokenHolder Contract

Used to build a bonus model for distributing bonuses to those who hold the token. Implement aelf Standards ACS1.

Contract Methods

Method NameRequest TypeResponse TypeDescription
CreateSchemeTokenHolder.CreateTokenHolderProfitSchemeInput google.protobuf.Empty <#google.protobuf.Empty>Create a scheme for distributing bonuses.
AddBeneficiaryTokenHolder.AddTokenHolderBeneficiaryInput google.protobuf.Empty <#google.protobuf.Empty>Add a beneficiary to a scheme.
RemoveBeneficiaryTokenHolder.RemoveTokenHolderBeneficiaryInput google.protobuf.Empty <#google.protobuf.Empty>Removes a beneficiary from a scheme. Note: amount > 0: update the weight of the beneficiary, amount = 0: remove the beneficiary.
ContributeProfitsTokenHolder.ContributeProfitsInput google.protobuf.Empty <#google.protobuf.Empty>Contribute profit to a scheme.
DistributeProfitsTokenHolder.DistributeProfitsInput google.protobuf.Empty <#google.protobuf.Empty>To distribute the profits of the scheme, the stakeholders of the project may go to receive dividends.
RegisterForProfitsTokenHolder.RegisterForProfitsInput google.protobuf.Empty <#google.protobuf.Empty>The user registers a bonus project.
Withdrawaelf.Address google.protobuf.Empty <#google.protobuf.Empty>After the lockup time expires, the user can withdraw tokens.
ClaimProfitsTokenHolder.ClaimProfitsInput google.protobuf.Empty <#google.protobuf.Empty>After DistributeProfits, the holder can get his dividend.
GetSchemeaelf.Address TokenHolder.TokenHolderProfitScheme Query the details of the specified scheme.
GetProfitsMapTokenHolder.ClaimProfitsInputTokenHolder.ReceivedProfitsMap Query the dividends available to the holder.

AElf.Standards.ACS1

Method NameRequest TypeResponse TypeDescription
SetMethodFeeacs1.MethodFees google.protobuf.Empty <#google.protobuf.Empty>Set the method fees for the specified method. Note that this will override all fees of the method.
ChangeMethodFeeControllerAuthorityInfo <#AuthorityInfo>google.protobuf.Empty <#google.protobuf.Empty>Change the method fee controller, the default is parliament and default organization.
GetMethodFeegoogle.protobuf.StringValue <#google.protobuf.StringValue>acs1.MethodFees <#acs1.MethodFees>Query method fee information by method name.
GetMethodFeeControllergoogle.protobuf.Empty <#google.protobuf.Empty>AuthorityInfo <#AuthorityInfo>Query the method fee controller.

Contract Types

AElf.Contracts.TokenHolder

TokenHolder.AddTokenHolderBeneficiaryInput

FieldTypeDescriptionLabel
beneficiaryaelf.Address Beneficiary's address.
sharesint64 The weight of the beneficiary's dividends in the scheme.

TokenHolder.ClaimProfitsInput

FieldTypeDescriptionLabel
scheme_manageraelf.Address The manager of the scheme.
beneficiaryaelf.Address

TokenHolder.ContributeProfitsInput

FieldTypeDescriptionLabel
scheme_manageraelf.AddressThe manager of the scheme.
amountint64The amount of token to contribute.
symbolstringThe symbol of token to contribute.

TokenHolder.CreateTokenHolderProfitSchemeInput

FieldTypeDescriptionLabel
symbolstringThe token symbol.
minimum_lock_minutesint64Minimum lock time for holding token.
auto_distribute_thresholdCreateTokenHolderProfitSchemeInput.AutoDistributeThresholdEntryThreshold setting for releasing dividends.repeated

TokenHolder.CreateTokenHolderProfitSchemeInput.AutoDistributeThresholdEntry

FieldTypeDescriptionLabel
keystring
valueint64

TokenHolder.DistributeProfitsInput

FieldTypeDescriptionLabel
scheme_manageraelf.AddressThe manager of the scheme.
amounts_mapDistributeProfitsInput.AmountsMapEntryThe token to distribute, symbol -> amount.repeated

TokenHolder.DistributeProfitsInput.AmountsMapEntry

FieldTypeDescriptionLabel
keystring
valueint64

TokenHolder.ReceivedProfitsMap

FieldTypeDescriptionLabel
valueReceivedProfitsMap.ValueEntryThe amount of token the beneficiary can get, symbol -> amount.repeated

TokenHolder.ReceivedProfitsMap.ValueEntry

FieldTypeDescriptionLabel
keystring
valueint64

TokenHolder.RegisterForProfitsInput

FieldTypeDescriptionLabel
scheme_manageraelf.AddressThe manager of the scheme.
amountint64The amount of token holding.

TokenHolder.RemoveTokenHolderBeneficiaryInput

FieldTypeDescriptionLabel
beneficiaryaelf.AddressBeneficiary's address.
amountint64The amount of weights to remove.

TokenHolder.TokenHolderProfitScheme

FieldTypeDescriptionLabel
symbolstringThe token symbol.
scheme_idaelf.HashThe scheme id.
periodint64The current dividend period.
minimum_lock_minutesint64Minimum lock time for holding token.
auto_distribute_thresholdTokenHolderProfitScheme.AutoDistributeThresholdEntryThreshold setting for releasing dividends.repeated

TokenHolder.TokenHolderProfitScheme.AutoDistributeThresholdEntry

FieldTypeDescriptionLabel
keystring
valueint64

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.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
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 <#aelf.MerklePathNode>The merkle path nodes.repeated

aelf.MerklePathNode

FieldTypeDescriptionLabel
hashHash The node hash.
is_left_child_nodebool Whether it is 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
categorysint32The 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. 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_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.