logo

Profit Contract

The Profit contract is an abstract layer for creating a scheme to share bonuses. Developers can build a system to distribute bonuses by calling this contract. Implement aelf Standards ACS1.

Contract Methods#

Method NameRequest TypeResponse TypeDescription
CreateSchemeProfit.CreateSchemeInputaelf.HashCreate a scheme for profit distribution and return the created scheme id.
AddBeneficiaryProfit.AddBeneficiaryInputgoogle.protobuf.EmptyAdd beneficiary to scheme.
RemoveBeneficiaryProfit.RemoveBeneficiaryInputgoogle.protobuf.EmptyRemove beneficiary from scheme.
AddBeneficiariesProfit.AddBeneficiariesInputgoogle.protobuf.EmptyBatch add beneficiaries to scheme.
RemoveBeneficiariesProfit.RemoveBeneficiariesInputgoogle.protobuf.EmptyBatch remove beneficiaries from scheme.
ContributeProfitsProfit.ContributeProfitsInputgoogle.protobuf.EmptyContribute profit to a scheme.
ClaimProfitsProfit.ClaimProfitsInputgoogle.protobuf.EmptyThe beneficiary draws tokens from the scheme.
DistributeProfitsProfit.DistributeProfitsInputgoogle.protobuf.EmptyDistribute profits to schemes, including its sub-schemes according to period and token symbol; should be called by the manager.
AddSubSchemeProfit.AddSubSchemeInputgoogle.protobuf.EmptyAdd sub-scheme to a scheme. This effectively adds the specified sub-scheme as a beneficiary of the parent scheme.
RemoveSubSchemeProfit.RemoveSubSchemeInputgoogle.protobuf.EmptyRemove sub-scheme from a scheme.
ResetManagerProfit.ResetManagerInputgoogle.protobuf.EmptyReset the manager of a scheme.
GetManagingSchemeIdsProfit.GetManagingSchemeIdsInputProfit.CreatedSchemeIdsGet all schemes managed by the specified manager.
GetSchemeaelf.HashProfit.SchemeGet scheme according to scheme id.
GetSchemeAddressProfit.SchemePeriodaelf.AddressGet the virtual address of the number of periods of the scheme.
GetDistributedProfitsInfoProfit.SchemePeriodProfit.DistributedProfitsInfoQuery the distributed profit information for the specified period.
GetProfitDetailsProfit.GetProfitDetailsInputProfit.ProfitDetailsQuery the beneficiary's profit information on the scheme.
GetProfitAmountProfit.GetProfitAmountInputgoogle.protobuf.Int64ValueQuery the amount of profit according to token symbol (up to 10 periods).
GetProfitsMapProfit.ClaimProfitsInputProfit.ReceivedProfitsMapQuery all profit (up to 10 periods).

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.

Contract Types

AElf.Contracts.Profit#

Profit.AddBeneficiariesInput#

FieldTypeDescriptionLabel
scheme_idaelf.HashThe scheme id.
beneficiary_sharesBeneficiaryShareThe beneficiary information.repeated
end_periodint64The end period for beneficiary profits.

Profit.AddBeneficiaryInput#

FieldTypeDescriptionLabel
scheme_idaelf.HashThe scheme id.
beneficiary_shareBeneficiaryShareThe beneficiary information.
end_periodint64The end period for beneficiary profits.

Profit.AddSubSchemeInput#

FieldTypeDescriptionLabel
scheme_idaelf.HashThe parent scheme id.
sub_scheme_idaelf.HashThe sub scheme id.
sub_scheme_sharesint64The profit weight of sub scheme.

Profit.BeneficiaryShare#

FieldTypeDescriptionLabel
beneficiaryaelf.AddressThe beneficiary's address.
sharesint64The profit weight of the beneficiary.

Profit.ClaimProfitsInput#

FieldTypeDescriptionLabel
scheme_idaelf.HashThe scheme id.
beneficiaryaelf.AddressThe beneficiary's address.

Profit.ContributeProfitsInput#

FieldTypeDescriptionLabel
scheme_idaelf.HashThe scheme id to contribute.
amountint64The amount to contribute.
periodint64The number of periods for dividends.
symbolstringThe token symbol to contribute.

Profit.CreateSchemeInput#

FieldTypeDescriptionLabel
profit_receiving_due_period_countint64Period of profit distribution.
is_release_all_balance_every_time_by_defaultboolWhether all the scheme balance is distributed each period.
delay_distribute_period_countint32Delay distribute period.
manageraelf.AddressThe manager of the scheme.
can_remove_beneficiary_directlyboolWhether you can directly remove beneficiaries.
tokenaelf.HashUsed to generate scheme id.

Profit.CreatedSchemeIds#

FieldTypeDescriptionLabel
scheme_idsaelf.HashThe scheme ids.repeated

Here's the content converted to Markdown format with the information presented in boxes:

Profit.DistributeProfitsInput#

FieldTypeDescriptionLabel
scheme_idaelf.HashThe scheme id to distribute.
periodint64The period number to distribute, current period.
amounts_mapAmountsMapEntryThe amount to distribute, symbol -> amount.repeated

Profit.DistributeProfitsInput.AmountsMapEntry#

FieldTypeDescriptionLabel
keystring
valueint64

Profit.DistributedProfitsInfo#

FieldTypeDescriptionLabel
total_sharesint64Total shares in this scheme at the current period.
amounts_mapAmountsMapEntryContributed amount in this scheme at the current period.repeated
is_releasedboolWhether released.

Profit.DistributedProfitsInfo.AmountsMapEntry#

FieldTypeDescriptionLabel
keystring
valuesint64

Profit.GetManagingSchemeIdsInput#

FieldTypeDescriptionLabel
manageraelf.AddressThe manager address.

Profit.GetProfitAmountInput#

FieldTypeDescriptionLabel
scheme_idaelf.HashThe scheme id.
symbolstringThe token symbol.
beneficiaryaelf.AddressBeneficiary's address.

Profit.GetProfitDetailsInput#

FieldTypeDescriptionLabel
scheme_idaelf.HashThe scheme id.
beneficiaryaelf.AddressBeneficiary's address.

Profit.ProfitDetail#

FieldTypeDescriptionLabel
start_periodint64The start period number.
end_periodint64The end period number.
sharesint64The weight of the proceeds on the current period of the scheme.
last_profit_periodint64The last period number that the beneficiary received the profit.
is_weight_removedboolWhether the weight has been removed.

Profit.ProfitDetails#

FieldTypeDescriptionLabel
detailsProfitDetailThe profit information.repeated

Profit.ProfitDetails.ProfitDetail#

FieldTypeDescriptionLabel
start_periodint64The start period number.
end_periodint64The end period number.
sharesint64The weight of the proceeds.
last_profit_periodint64The last period received.
is_weight_removedboolWhether weight removed.

Profit.ProfitsClaimed#

FieldTypeDescriptionLabel
beneficiaryaelf.AddressBeneficiary's address claimed.
symbolstringToken symbol claimed.
amountint64The amount claimed.
periodint64The period number claimed.
claimer_sharesint64Shares of the claimer.
total_sharesint64Total shares at current period.

Profit.ReceivedProfitsMap#

FieldTypeDescriptionLabel
valueReceivedProfitsMap.ValueEntryCollection of profits received, symbol -> amount.repeated

Profit.ReceivedProfitsMap.ValueEntry#

FieldTypeDescriptionLabel
keystring
valueint64

Profit.RemoveBeneficiariesInput#

FieldTypeDescriptionLabel
beneficiariesaelf.AddressAddresses of beneficiaries.repeated
scheme_idaelf.HashThe scheme id.

Profit.RemoveBeneficiaryInput#

FieldTypeDescriptionLabel
beneficiaryaelf.AddressBeneficiary's address.
scheme_idaelf.HashThe scheme id.

Profit.RemoveSubSchemeInput#

FieldTypeDescriptionLabel
scheme_idaelf.HashThe parent scheme id.
sub_scheme_idaelf.HashThe sub scheme id.

Profit.ResetManagerInput#

FieldTypeDescriptionLabel
scheme_idaelf.HashThe scheme id.
new_manageraelf.AddressAddress of new manager.

Profit.Scheme#

FieldTypeDescriptionLabel
virtual_addressaelf.AddressThe virtual address of the scheme.
total_sharesint64The total weight of the scheme.
manageraelf.AddressThe manager of the scheme.
current_periodint64The current period.
sub_schemesSchemeBeneficiaryShareSub schemes information.repeated
can_remove_beneficiary_directlyboolWhether you can directly remove the beneficiary.
profit_receiving_due_period_countint64Period of profit distribution.
is_release_all_balance_every_time_by_defaultboolWhether all the schemes balance will be distributed during distribution each period.
scheme_idaelf.HashThe is of the scheme.
delay_distribute_period_countint32Delay distribute period.
cached_delay_total_sharesScheme.CachedDelayTotalSharesEntryRecord the scheme's current total share for deferred distribution of benefits, period -> total shares.repeated
received_token_symbolsstringThe received token symbols.repeated

Profit.Scheme.CachedDelayTotalSharesEntry#

FieldTypeDescriptionLabel
keyint64
valueint64

Profit.SchemeBeneficiaryShare#

FieldTypeDescriptionLabel
scheme_idaelf.HashThe id of the sub scheme.
sharesint64The weight of the sub scheme.

Profit.SchemeCreated#

FieldTypeDescriptionLabel
virtual_addressaelf.AddressThe virtual address of the created scheme.
manageraelf.AddressThe manager of the created scheme.
profit_receiving_due_period_countint64Period of profit distribution.
is_release_all_balance_every_time_by_defaultboolWhether all the schemes balance will be distributed each period.
scheme_idaelf.HashThe id of the created scheme.

Profit.SchemePeriod#

FieldTypeDescriptionLabel
scheme_idaelf.HashThe scheme id.
periodint64The period number.

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

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

Edited on: 16 July 2024 04:52:34 GMT+0