aelf Tech Talks — aelf Profit Contract Interpretation Pt 2

aelf Developer
aelf
Published in
5 min readApr 15, 2020

Methods Interpretation

Create the profit scheme

The interface used to create the bonus scheme is as follows:

A profit scheme with the following attributes:

  • A unique virtual address serves as the General Ledger address for the profit scheme
  • Total shares
  • The balance has not been released (may be removed)
  • Current Accounting Period
  • Sub-profit scheme information
  • Whether it is permissible to remove the profit beneficiary without regarding the number of payable periods
  • Profit retention periods (can not be collected after expiration date)
  • Tacitly approve to issue all the quota corresponding to a Token in the General Ledger
  • Unique Identification of Profit scheme
  • Delayed profit distribution periods
  • The total shares that need to be cached for delayed profit distribution
  • Managers

Sub profit item management

Used to add and remove sub profit item

To add a sub profit scheme, you need to fill in the ID of two profit scheme with cascading relationship, and then you need to enter the share of the sub profit scheme. To remove the cascading relationship, you only need to enter the ID of two profit scheme respectively.

Beneficiary management

A batch management interface is provided to add and remove dividend beneficiaries.

When adding a profit beneficiary, you need to specify not only the profit scheme ID of the profit beneficiary address and the shares, but also the number of the last accounting period that the beneficiary can receive the profit. Once added, the profit can be received continually until the manager of the profit scheme invokes the RemoveBeneficiary method to remove its shares. (If the value of the can_remove_beneficiary_directly is True, all shares can be removed directly)

Add (Contribute) Profit

Add a certain number of tokens for profit to the designated profit items, and the currency will be specified when adding. (In other words, a profit scheme can distribute multiple tokens, but each profit accounting period can only issue one token on the book)

When period is 0, this token will be added to the virtual address of the profit item (it can be called general ledger). When a period greater than 0 is specified, this token will be added to the virtual address of the specified period.

Distribute Profit

How to distribute profit

Period is the accounting period of this profit release, which cannot be released by skipping. However, it is necessary to pass in the release accounting period for contract inspection, so as to prevent the creator of the profit project from sending two identical transactions inadvertently, resulting in the profit being released twice. When amount is set to 0 and is_release_all_balance_everytime_by_default is specified when the profit item is created, all balances on the virtual address of the profit item will be released. Because the available total weight of the delayed release profit item cannot use the total weight of the profit item when it is released, the total weight can only be set to the total weight at a certain time point in the past.

Receive Profit

The profit beneficiary can receive the profit that has not been received by the specified profit scheme through this interface.

Provide the profit scheme ID to obtain the available profit (up to 10 periods). If benefit is 0, Sender will receive profit; if not, it will give profits to others.

— Join the Community:

· Get on our Telegram Discord Slack and Kakao channel

· Follow us on Twitter Reddit and Facebook

· Read weekly articles on the aelf blog

· Catch up with the develop progress on Github

· Telegram community in 한국 ,日本語 ,русский ,العربية ,Deutsch ,ItalianoandTiếng Việt,

· Instagram: aelfblockchain

· YouTube Channel: aelf

For more information, visit aelf.io

--

--