AElf.Contracts.Profit
Profit contract.
The Profit contract is an abstract layer for creating scheme to share bonus. Developers can build a system to distribute bonus by call this contract.
Implement AElf Standards ACS1.
Contract Methods
Method Name |
Request Type |
Response Type |
Description |
---|---|---|---|
CreateScheme |
Create a scheme for profit distribution, and return the created scheme id. |
||
AddBeneficiary |
Add beneficiary to scheme. |
||
RemoveBeneficiary |
Remove beneficiary from scheme. |
||
AddBeneficiaries |
Batch add beneficiary to scheme. |
||
RemoveBeneficiaries |
Batch remove beneficiary from scheme. |
||
ContributeProfits |
Contribute profit to a scheme. |
||
ClaimProfits |
The beneficiary draws tokens from the scheme. |
||
DistributeProfits |
Distribute profits to schemes, including its sub scheme according to period and token symbol, should be called by the manager. |
||
AddSubScheme |
Add sub scheme to a scheme. This will effectively add the specified sub-scheme as a beneficiary of the parent scheme. |
||
RemoveSubScheme |
Remove sub scheme from a scheme. |
||
ResetManager |
Reset the manager of a scheme. |
||
GetManagingSchemeIds |
Get all schemes managed by the specified manager. |
||
GetScheme |
Get scheme according to scheme id. |
||
GetSchemeAddress |
Get the virtual address of the number of period of the scheme. |
||
GetDistributedProfitsInfo |
Query the distributed profit information for the specified period. |
||
GetProfitDetails |
Query the beneficiary’s profit information on the scheme. |
||
GetProfitAmount |
Query the amount of profit according to token symbol. (up to 10 periods). |
||
GetProfitsMap |
Query all profit (up to 10 periods). |
AElf.Standards.ACS1
Method Name |
Request Type |
Response Type |
Description |
---|---|---|---|
SetMethodFee |
Set the method fees for the specified method. Note that this will override all fees of the method. |
||
ChangeMethodFeeController |
Change the method fee controller, the default is parliament and default organization. |
||
GetMethodFee |
Query method fee information by method name. |
||
GetMethodFeeController |
Query the method fee controller. |
Contract Types
AElf.Contracts.Profit
Profit.AddBeneficiariesInput
Field |
Type |
Description |
Label |
---|---|---|---|
scheme_id |
The scheme id. |
||
beneficiary_shares |
The beneficiary information. |
repeated |
|
end_period |
The end period which the beneficiary receives the profit. |
Profit.AddBeneficiaryInput
Field |
Type |
Description |
Label |
---|---|---|---|
scheme_id |
The scheme id. |
||
beneficiary_share |
The beneficiary information. |
||
end_period |
The end period which the beneficiary receives the profit. |
Profit.AddSubSchemeInput
Field |
Type |
Description |
Label |
---|---|---|---|
scheme_id |
The parent scheme id. |
||
sub_scheme_id |
The sub scheme id. |
||
sub_scheme_shares |
The profit weight of sub scheme. |
Profit.ClaimProfitsInput
Field |
Type |
Description |
Label |
---|---|---|---|
scheme_id |
The scheme id. |
||
beneficiary |
The address of beneficiary. |
Profit.ContributeProfitsInput
Field |
Type |
Description |
Label |
---|---|---|---|
scheme_id |
The scheme id to contribute. |
||
amount |
The amount to contribute. |
||
period |
The number of periods in which the income is used for dividends. |
||
symbol |
The token symbol to contribute. |
Profit.CreateSchemeInput
Field |
Type |
Description |
Label |
---|---|---|---|
profit_receiving_due_period_count |
Period of profit distribution. |
||
is_release_all_balance_every_time_by_default |
Whether all the schemes balance will be distributed during distribution each period. |
||
delay_distribute_period_count |
Delay distribute period. |
||
manager |
The manager of this scheme, the default is the creator. |
||
can_remove_beneficiary_directly |
Whether you can directly remove the beneficiary. |
||
token |
Use to generate scheme id. |
Profit.CreatedSchemeIds
Field |
Type |
Description |
Label |
---|---|---|---|
scheme_ids |
The scheme ids. |
repeated |
Profit.DistributeProfitsInput
Field |
Type |
Description |
Label |
---|---|---|---|
scheme_id |
The scheme id to distribute. |
||
period |
The period number to distribute, should be the current period. |
||
amounts_map |
The amount to distribute, symbol -> amount. |
repeated |
Profit.DistributeProfitsInput.AmountsMapEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
Profit.DistributedProfitsInfo
Field |
Type |
Description |
Label |
---|---|---|---|
total_shares |
The total amount of shares in this scheme at the current period. |
||
amounts_map |
The contributed amount in this scheme at the current period. |
repeated |
|
is_released |
Whether released. |
Profit.DistributedProfitsInfo.AmountsMapEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
Profit.GetManagingSchemeIdsInput
Field |
Type |
Description |
Label |
---|---|---|---|
manager |
The manager address. |
Profit.GetProfitAmountInput
Field |
Type |
Description |
Label |
---|---|---|---|
scheme_id |
The scheme id. |
||
symbol |
The token symbol. |
||
beneficiary |
The beneficiary’s address. |
Profit.GetProfitDetailsInput
Field |
Type |
Description |
Label |
---|---|---|---|
scheme_id |
The scheme id. |
||
beneficiary |
The address of beneficiary. |
Profit.ProfitDetail
Field |
Type |
Description |
Label |
---|---|---|---|
start_period |
The start period number. |
||
end_period |
The end period number. |
||
shares |
The weight of the proceeds on the current period of the scheme. |
||
last_profit_period |
The last period number that the beneficiary received the profit. |
||
is_weight_removed |
Whether the weight has been removed. |
Profit.ProfitDetails
Field |
Type |
Description |
Label |
---|---|---|---|
details |
The profit information. |
repeated |
Profit.ProfitsClaimed
Field |
Type |
Description |
Label |
---|---|---|---|
beneficiary |
The beneficiary’s address claimed. |
||
symbol |
The token symbol claimed. |
||
amount |
The amount claimed. |
||
period |
The period number claimed. |
||
claimer_shares |
The shares of the claimer. |
||
total_shares |
The total shares at the current period. |
Profit.ReceivedProfitsMap
Field |
Type |
Description |
Label |
---|---|---|---|
value |
The collection of profits received, token symbol -> amount. |
repeated |
Profit.ReceivedProfitsMap.ValueEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
Profit.RemoveBeneficiariesInput
Field |
Type |
Description |
Label |
---|---|---|---|
beneficiaries |
The addresses of beneficiary. |
repeated |
|
scheme_id |
The scheme id. |
Profit.RemoveBeneficiaryInput
Field |
Type |
Description |
Label |
---|---|---|---|
beneficiary |
The address of beneficiary. |
||
scheme_id |
The scheme id. |
Profit.RemoveSubSchemeInput
Field |
Type |
Description |
Label |
---|---|---|---|
scheme_id |
The parent scheme id. |
||
sub_scheme_id |
The sub scheme id. |
Profit.ResetManagerInput
Field |
Type |
Description |
Label |
---|---|---|---|
scheme_id |
The scheme id. |
||
new_manager |
The address of new manager. |
Profit.Scheme
Field |
Type |
Description |
Label |
---|---|---|---|
virtual_address |
The virtual address of the scheme. |
||
total_shares |
The total weight of the scheme. |
||
manager |
The manager of the scheme. |
||
current_period |
The current period. |
||
sub_schemes |
Sub schemes information. |
repeated |
|
can_remove_beneficiary_directly |
Whether you can directly remove the beneficiary. |
||
profit_receiving_due_period_count |
Period of profit distribution. |
||
is_release_all_balance_every_time_by_default |
Whether all the schemes balance will be distributed during distribution each period. |
||
scheme_id |
The is of the scheme. |
||
delay_distribute_period_count |
Delay distribute period. |
||
cached_delay_total_shares |
Record the scheme’s current total share for deferred distribution of benefits, period -> total shares. |
repeated |
|
received_token_symbols |
The received token symbols. |
repeated |
Profit.SchemeCreated
Field |
Type |
Description |
Label |
---|---|---|---|
virtual_address |
The virtual address of the created scheme. |
||
manager |
The manager of the created scheme. |
||
profit_receiving_due_period_count |
Period of profit distribution. |
||
is_release_all_balance_every_time_by_default |
Whether all the schemes balance will be distributed during distribution each period. |
||
scheme_id |
The id of the created scheme. |
Profit.SchemePeriod
Field |
Type |
Description |
Label |
---|---|---|---|
scheme_id |
The scheme id. |
||
period |
The period number. |
AElf.Standards.ACS1
acs1.MethodFee
Field |
Type |
Description |
Label |
---|---|---|---|
symbol |
The token symbol of the method fee. |
||
basic_fee |
The amount of fees to be charged. |
acs1.MethodFees
Field |
Type |
Description |
Label |
---|---|---|---|
method_name |
The name of the method to be charged. |
||
fees |
List of fees to be charged. |
repeated |
|
is_size_fee_free |
Optional based on the implementation of SetMethodFee method. |
AElf.Types
aelf.Address
Field |
Type |
Description |
Label |
---|---|---|---|
value |
aelf.BinaryMerkleTree
Field |
Type |
Description |
Label |
---|---|---|---|
nodes |
The leaf nodes. |
repeated |
|
root |
The root node hash. |
||
leaf_count |
The count of leaf node. |
aelf.Hash
Field |
Type |
Description |
Label |
---|---|---|---|
value |
aelf.LogEvent
Field |
Type |
Description |
Label |
---|---|---|---|
address |
The contract address. |
||
name |
The name of the log event. |
||
indexed |
The indexed data, used to calculate bloom. |
repeated |
|
non_indexed |
The non indexed data. |
aelf.MerklePath
Field |
Type |
Description |
Label |
---|---|---|---|
merkle_path_nodes |
The merkle path nodes. |
repeated |
aelf.MerklePathNode
Field |
Type |
Description |
Label |
---|---|---|---|
hash |
The node hash. |
||
is_left_child_node |
Whether it is a left child node. |
aelf.SInt32Value
Field |
Type |
Description |
Label |
---|---|---|---|
value |
aelf.SInt64Value
Field |
Type |
Description |
Label |
---|---|---|---|
value |
aelf.ScopedStatePath
Field |
Type |
Description |
Label |
---|---|---|---|
address |
The scope address, which will be the contract address. |
||
path |
The path of contract state. |
aelf.SmartContractRegistration
Field |
Type |
Description |
Label |
---|---|---|---|
category |
The category of contract code(0: C#). |
||
code |
The byte array of the contract code. |
||
code_hash |
The hash of the contract code. |
||
is_system_contract |
Whether it is a system contract. |
||
version |
The version of the current contract. |
aelf.StatePath
Field |
Type |
Description |
Label |
---|---|---|---|
parts |
The partial path of the state path. |
repeated |
aelf.Transaction
Field |
Type |
Description |
Label |
---|---|---|---|
from |
The address of the sender of the transaction. |
||
to |
The address of the contract when calling a contract. |
||
ref_block_number |
The height of the referenced block hash. |
||
ref_block_prefix |
The first four bytes of the referenced block hash. |
||
method_name |
The name of a method in the smart contract at the To address. |
||
params |
The parameters to pass to the smart contract method. |
||
signature |
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
Field |
Type |
Description |
Label |
---|---|---|---|
writes |
The changed states. |
repeated |
|
reads |
The read states. |
repeated |
|
deletes |
The deleted states. |
repeated |
aelf.TransactionExecutingStateSet.DeletesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
aelf.TransactionExecutingStateSet.ReadsEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
aelf.TransactionExecutingStateSet.WritesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
aelf.TransactionResult
Field |
Type |
Description |
Label |
---|---|---|---|
transaction_id |
The transaction id. |
||
status |
The transaction result status. |
||
logs |
The log events. |
repeated |
|
bloom |
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_value |
The return value of the transaction execution. |
||
block_number |
The height of the block hat packages the transaction. |
||
block_hash |
The hash of the block hat packages the transaction. |
||
error |
Failed execution error message. |
aelf.TransactionResultStatus
Name |
Number |
Description |
---|---|---|
NOT_EXISTED |
0 |
The execution result of the transaction does not exist. |
PENDING |
1 |
The transaction is in the transaction pool waiting to be packaged. |
FAILED |
2 |
Transaction execution failed. |
MINED |
3 |
The transaction was successfully executed and successfully packaged into a block. |
CONFLICT |
4 |
When executed in parallel, there are conflicts with other transactions. |
PENDING_VALIDATION |
5 |
The transaction is waiting for validation. |
NODE_VALIDATION_FAILED |
6 |
Transaction validation failed. |