Distribution Bundles
Distribution bundles are modules of code designed to determine what addresses should be credited and how many rewards they will receive for a given period when a campaign is active.
Overview
Distribution bundles play a crucial role in reward campaigns by:
- Determining eligible addresses for rewards
- Calculating reward amounts for each eligible address
- Periodically running to update reward allocations
Bundles analyze rewards per block, leading to deterministic and consistent reward calculations.
Example: Incentivizing Liquidity Providers
When incentivizing liquidity providers (LPs) on a liquidity pool:
- The campaign begins
- The distribution bundle runs periodically
- It pulls all active LPs
- Factors in additional parameters (e.g., ALM positions)
- Assigns rewards to users
- Tracks claims and adds them to pending claims for the campaign
Claims will be available on the next publishing of rewards.
Note: Custom distribution bundles can be written to incentivize any sort of on-chain or off-chain actions, or a combination of both.
Distribution Bundle Interface
Context Provided to the Bundle
The distribution bundle receives a context object with the following structure:
type CampaignType = {
campaign: {
id: number;
liquidityPool: string;
rewardToken: string;
creator: string;
startBlock: string;
endBlock: string;
distributionAmount: string;
abandonedDeadline: string;
cumulativeAllocated: string;
lastBlockUpdatedTo: number;
paused: boolean;
closed: boolean;
ipfsHash: string;
chainId: number;
ponderDbIdentifier: string;
executionBundle: string;
executionParams: string;
desc: string;
created_at: string;
updated_at: string;
campaignEventId: string;
campaignId: string;
};
poolContext: {
chainId: number;
poolAddress: string;
eventBlock: number;
dbIdentifier: string;
};
lastUpdatedBlockNumber: number;
ponderDbIdentifier: string;
eventBlockNumber: number;
apiBaseUrl: string;
blackList: string[];
};
Expected Output
The distribution bundle should return a stringified array of Claim
objects:
export class Claim {
user: string = "";
additionalAmount: string = ""
}
Implementation Considerations
When implementing a distribution bundle:
- Process the provided context to identify eligible users
- Calculate reward amounts based on the campaign parameters and user activity
- Create
Claim
objects for each eligible user - Return the stringified array of
Claim
objects
By following this interface, you can create custom distribution bundles tailored to specific incentivization strategies for various on-chain and off-chain actions.