Introduction
Allo uses a single strategy contract to handle all logic around recipients,
allocations, and token distribution. Developers can choose to create a custom
strategy or clone an existing one. Allo provides a BaseStrategy
that all
strategies should inherit from. For more information, see the Writing a Custom
Strategy page. Strategies must be
deployed prior to creating a new pool.
To help illustrate strategy concepts, this documentation will refer to the
DonationVotingStrategy.sol
(opens in a new tab)
strategy as an example.
Recipients
Recipients refer to groups or individuals who can receive allocations from the pool. Strategy logic determines how eligible recipients are identified and registered.
At a minimum, the recipient logic should consider:
- How recipient eligibility is determined
- What statuses a recipient may need to go through when registering
- How recipients will be identified
- Any additional data that is required for a recipient to be registered and eventually receive funds
The registerRecipient
function is inherited from the
BaseStrategy.sol
contract and needs to be completed in a custom strategy.
In the DonationVotingStrategy.sol
example, recipients are identified by
their wallet address and are required to submit an application that is then
reviewed by the pool manager. Applications are only accepted during a specified
time period. Upon submission, the recipient is in a 'Pending' status, and after
review are either 'Accepted' or 'Rejected'.
Allocations
Allocation logic determines how and when allocators can express opinions about
distributing the pool's funds to recipients. Allocators are wallet addresses
that are able to utilize the allocate
function. Each strategy will need to
determine what makes a wallet eligible to be an allocator. Allocation can be as
complex or simple as needed for a given strategy.
Some common considerations include:
- Is there a certain time period allocation can occur during?
- Can an allocator allocate multiple times?
- Does allocation require funds to be sent, and if so where are they stored?
The DonationVotingStrategy.sol
contract marks all addresses as eligible
and they may allocate multiple times. Allocation involves donating pre-approved
tokens to the recipient. Allocation can only occur during a specified allocation
window.
Token Distribution
Finally, strategies need to determine how payouts are handled for recipients.
Payout logic may include:
- Calculating payout amounts
- Determining when and how often payouts occur
- Ensuring payout eligibility and accuracy
- Managing who can initiate a payout
Payouts are handled through the distribute
function.
The DonationVotingStrategy.sol
contract allows anyone to distribute funds,
as long as a pool manager has determined the funds are ready for payout. It also
includes the capability to reclaim undistributed funds 30 days after allocation
has ended.
Strategy Library
The Strategy Library (opens in a new tab) includes a variety of strategy contracts. These contracts can be used as is or as a starting point for a custom strategy.