This contract receives surplus B3TR allocations from XAllocationPool and distributes them to eligible apps using a flat distribution with a merit cap.
——— Version 2 ——— - Add storage to track the reward amount for each app for each round - Add seed function to seed historical rewards
——— Version 3 ——— - Merit-capped flat distribution: each app gets min(flatShare, meritCapMultiplier * voteAllocation) - Overflow from merit cap + integer remainder sent to VBD Treasury - Treasury address and meritCapMultiplier stored on-chain
bytes32 UPGRADER_ROLE
The role that can upgrade the contract.
bytes32 DISTRIBUTOR_ROLE
The role that can distribute funds to apps.
struct DBAPoolStorage {
contract IX2EarnApps x2EarnApps;
contract IXAllocationPool xAllocationPool;
contract IX2EarnRewardsPool x2EarnRewardsPool;
contract IB3TR b3tr;
uint256 distributionStartRound;
mapping(uint256 => bool) dbaRewardsDistributed;
mapping(uint256 => mapping(bytes32 => uint256)) dbaRoundRewardsForApp;
address treasuryAddress;
uint256 meritCapMultiplier;
}
constructor() public
struct InitializeV1Params {
address admin;
address x2EarnApps;
address xAllocationPool;
address x2earnRewardsPool;
address b3tr;
uint256 distributionStartRound;
}
function initialize(struct DBAPool.InitializeV1Params params) public
function initializeV3(address _treasuryAddress) public
V3 reinitializer: sets the treasury address for overflow routing
| Name | Type | Description |
|---|---|---|
| _treasuryAddress | address | The VBD Treasury address |
function _authorizeUpgrade(address _newImplementation) internal
Authorizes the upgrade of the contract.
| Name | Type | Description |
|---|---|---|
| _newImplementation | address | The new implementation address. |
function distributeDBARewards(uint256 _roundId, bytes32[] _appIds) external
Distributes DBA rewards to eligible apps for a specific round.
The DBA pool is split evenly across all eligible apps (flat share). Each app’s reward is capped at 2x its vote allocation for the round. Any overflow from the merit cap plus the integer-division remainder is routed to the VBD Treasury.
| Name | Type | Description |
|---|---|---|
| _roundId | uint256 | The round ID for which to distribute DBA rewards. |
| _appIds | bytes32[] | Array of eligible app IDs (pre-filtered by off-chain service). |
function dbaRoundRewardsForApp(uint256 _roundId, bytes32 _appId) external view returns (uint256)
Gets the reward amount distributed to a specific app for a specific round
| Name | Type | Description |
|---|---|---|
| _roundId | uint256 | The round ID to check |
| _appId | bytes32 | The app ID to check |
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The reward amount for the app for the round or 0 if no rewards have been distributed |
function b3trBalance() external view returns (uint256)
Gets the current B3TR balance of this contract
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The current B3TR balance |
function canDistributeDBARewards(uint256 _roundId) external view returns (bool)
External getter to check if DBA rewards can be distributed for a specific round
| Name | Type | Description |
|---|---|---|
| _roundId | uint256 | The round ID to check |
| Name | Type | Description |
|---|---|---|
| [0] | bool | True if DBA rewards can be distributed for the round |
function _canDistributeDBARewards(struct DBAPool.DBAPoolStorage $, uint256 _roundId) internal view returns (bool)
Internal function to check if DBA rewards can be distributed for a specific round
| Name | Type | Description |
|---|---|---|
| $ | struct DBAPool.DBAPoolStorage | |
| _roundId | uint256 | The round ID to check |
| Name | Type | Description |
|---|---|---|
| [0] | bool | True if DBA rewards can be distributed for the round |
function fundsForRound(uint256 _roundId) external view returns (uint256)
External getter to get the amount of funds to distribute for a specific round
| Name | Type | Description |
|---|---|---|
| _roundId | uint256 | The round ID to check |
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The amount of funds to distribute for the round |
function isDBARewardsDistributed(uint256 _roundId) external view returns (bool)
Checks if DBA rewards have been distributed for a specific round
| Name | Type | Description |
|---|---|---|
| _roundId | uint256 | The round ID to check |
| Name | Type | Description |
|---|---|---|
| [0] | bool | True if rewards have been distributed for the round |
function distributionStartRound() external view returns (uint256)
Gets the starting round for DBA distribution
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The starting round ID |
function treasuryAddress() external view returns (address)
Gets the treasury address for overflow routing
| Name | Type | Description |
|---|---|---|
| [0] | address | The treasury address |
function meritCapMultiplier() external view returns (uint256)
Gets the merit cap multiplier
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The merit cap multiplier |
function x2EarnApps() external view returns (contract IX2EarnApps)
Gets the X2EarnApps contract
| Name | Type | Description |
|---|---|---|
| [0] | contract IX2EarnApps | The contract interface |
function b3tr() external view returns (contract IB3TR)
Gets the B3TR token contract
| Name | Type | Description |
|---|---|---|
| [0] | contract IB3TR | The contract interface |
function xAllocationPool() external view returns (contract IXAllocationPool)
Gets the XAllocationPool contract
| Name | Type | Description |
|---|---|---|
| [0] | contract IXAllocationPool | The contract interface |
function x2EarnRewardsPool() external view returns (contract IX2EarnRewardsPool)
Gets the X2EarnRewardsPool contract
| Name | Type | Description |
|---|---|---|
| [0] | contract IX2EarnRewardsPool | The contract interface |
function version() external pure returns (string)
Gets the contract version
| Name | Type | Description |
|---|---|---|
| [0] | string | The version string |
function pause() external
Pauses the contract
function unpause() external
Unpauses the contract
function setX2EarnApps(contract IX2EarnApps _x2EarnApps) external
Updates the X2EarnApps contract
| Name | Type | Description |
|---|---|---|
| _x2EarnApps | contract IX2EarnApps | The new contract interface |
function setXAllocationPool(contract IXAllocationPool _xAllocationPool) external
Updates the XAllocationPool contract
| Name | Type | Description |
|---|---|---|
| _xAllocationPool | contract IXAllocationPool | The new contract interface |
function setX2EarnRewardsPool(contract IX2EarnRewardsPool _x2EarnRewardsPool) external
Updates the X2EarnRewardsPool contract
| Name | Type | Description |
|---|---|---|
| _x2EarnRewardsPool | contract IX2EarnRewardsPool | The new contract interface |
function setDistributionStartRound(uint256 _distributionStartRound) external
Updates the distribution start round
| Name | Type | Description |
|---|---|---|
| _distributionStartRound | uint256 | The new distribution start round |
function setTreasuryAddress(address _treasuryAddress) external
Updates the treasury address for overflow routing
| Name | Type | Description |
|---|---|---|
| _treasuryAddress | address | The new treasury address |
function setMeritCapMultiplier(uint256 _meritCapMultiplier) external
Updates the merit cap multiplier
| Name | Type | Description |
|---|---|---|
| _meritCapMultiplier | uint256 | The new multiplier (e.g. 2 = 2x vote allocation) |
function seedDBARewardsForApps(uint256[] _roundIds, bytes32[] _appIds, uint256[] _amounts) external
Seeds the reward amounts for multiple apps across multiple rounds (batch operation)
| Name | Type | Description |
|---|---|---|
| _roundIds | uint256[] | Array of round IDs to seed |
| _appIds | bytes32[] | Array of app IDs to seed |
| _amounts | uint256[] | Array of amounts to seed |