This contract receives surplus B3TR allocations from XAllocationPool. Initially acts as a wallet/treasury where the VeBetter team can manually distribute surplus allocations to eligible apps. Future upgrades will add on-chain calculation and permissionless distribution capabilities.
——— Version 2 ——— - Add storage to track the reward amount for each app for each round - Add seed function to seed historical rewards
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;
}
constructor() public
struct InitializeV1Params {
address admin;
address x2EarnApps;
address xAllocationPool;
address x2earnRewardsPool;
address b3tr;
uint256 distributionStartRound;
}
function initialize(struct DBAPool.InitializeV1Params params) public
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.
This function equally distributes the unallocated funds sent to the DBA contract among the list of provided apps. A lambda/off-chain service filters eligible apps based on the proposal criteria. Can only be called once per round and only for rounds >= startRound.
| 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 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 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 |