Solidity API

DBAPool

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

UPGRADER_ROLE

bytes32 UPGRADER_ROLE

The role that can upgrade the contract.

DISTRIBUTOR_ROLE

bytes32 DISTRIBUTOR_ROLE

The role that can distribute funds to apps.

DBAPoolStorage

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

constructor() public

InitializeV1Params

struct InitializeV1Params {
  address admin;
  address x2EarnApps;
  address xAllocationPool;
  address x2earnRewardsPool;
  address b3tr;
  uint256 distributionStartRound;
}

initialize

function initialize(struct DBAPool.InitializeV1Params params) public

initializeV3

function initializeV3(address _treasuryAddress) public

V3 reinitializer: sets the treasury address for overflow routing

Parameters

Name Type Description
_treasuryAddress address The VBD Treasury address

_authorizeUpgrade

function _authorizeUpgrade(address _newImplementation) internal

Authorizes the upgrade of the contract.

Parameters

Name Type Description
_newImplementation address The new implementation address.

distributeDBARewards

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.

Parameters

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).

dbaRoundRewardsForApp

function dbaRoundRewardsForApp(uint256 _roundId, bytes32 _appId) external view returns (uint256)

Gets the reward amount distributed to a specific app for a specific round

Parameters

Name Type Description
_roundId uint256 The round ID to check
_appId bytes32 The app ID to check

Return Values

Name Type Description
[0] uint256 The reward amount for the app for the round or 0 if no rewards have been distributed

b3trBalance

function b3trBalance() external view returns (uint256)

Gets the current B3TR balance of this contract

Return Values

Name Type Description
[0] uint256 The current B3TR balance

canDistributeDBARewards

function canDistributeDBARewards(uint256 _roundId) external view returns (bool)

External getter to check if DBA rewards can be distributed for a specific round

Parameters

Name Type Description
_roundId uint256 The round ID to check

Return Values

Name Type Description
[0] bool True if DBA rewards can be distributed for the round

_canDistributeDBARewards

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

Parameters

Name Type Description
$ struct DBAPool.DBAPoolStorage
_roundId uint256 The round ID to check

Return Values

Name Type Description
[0] bool True if DBA rewards can be distributed for the round

fundsForRound

function fundsForRound(uint256 _roundId) external view returns (uint256)

External getter to get the amount of funds to distribute for a specific round

Parameters

Name Type Description
_roundId uint256 The round ID to check

Return Values

Name Type Description
[0] uint256 The amount of funds to distribute for the round

isDBARewardsDistributed

function isDBARewardsDistributed(uint256 _roundId) external view returns (bool)

Checks if DBA rewards have been distributed for a specific round

Parameters

Name Type Description
_roundId uint256 The round ID to check

Return Values

Name Type Description
[0] bool True if rewards have been distributed for the round

distributionStartRound

function distributionStartRound() external view returns (uint256)

Gets the starting round for DBA distribution

Return Values

Name Type Description
[0] uint256 The starting round ID

treasuryAddress

function treasuryAddress() external view returns (address)

Gets the treasury address for overflow routing

Return Values

Name Type Description
[0] address The treasury address

meritCapMultiplier

function meritCapMultiplier() external view returns (uint256)

Gets the merit cap multiplier

Return Values

Name Type Description
[0] uint256 The merit cap multiplier

x2EarnApps

function x2EarnApps() external view returns (contract IX2EarnApps)

Gets the X2EarnApps contract

Return Values

Name Type Description
[0] contract IX2EarnApps The contract interface

b3tr

function b3tr() external view returns (contract IB3TR)

Gets the B3TR token contract

Return Values

Name Type Description
[0] contract IB3TR The contract interface

xAllocationPool

function xAllocationPool() external view returns (contract IXAllocationPool)

Gets the XAllocationPool contract

Return Values

Name Type Description
[0] contract IXAllocationPool The contract interface

x2EarnRewardsPool

function x2EarnRewardsPool() external view returns (contract IX2EarnRewardsPool)

Gets the X2EarnRewardsPool contract

Return Values

Name Type Description
[0] contract IX2EarnRewardsPool The contract interface

version

function version() external pure returns (string)

Gets the contract version

Return Values

Name Type Description
[0] string The version string

pause

function pause() external

Pauses the contract

unpause

function unpause() external

Unpauses the contract

setX2EarnApps

function setX2EarnApps(contract IX2EarnApps _x2EarnApps) external

Updates the X2EarnApps contract

Parameters

Name Type Description
_x2EarnApps contract IX2EarnApps The new contract interface

setXAllocationPool

function setXAllocationPool(contract IXAllocationPool _xAllocationPool) external

Updates the XAllocationPool contract

Parameters

Name Type Description
_xAllocationPool contract IXAllocationPool The new contract interface

setX2EarnRewardsPool

function setX2EarnRewardsPool(contract IX2EarnRewardsPool _x2EarnRewardsPool) external

Updates the X2EarnRewardsPool contract

Parameters

Name Type Description
_x2EarnRewardsPool contract IX2EarnRewardsPool The new contract interface

setDistributionStartRound

function setDistributionStartRound(uint256 _distributionStartRound) external

Updates the distribution start round

Parameters

Name Type Description
_distributionStartRound uint256 The new distribution start round

setTreasuryAddress

function setTreasuryAddress(address _treasuryAddress) external

Updates the treasury address for overflow routing

Parameters

Name Type Description
_treasuryAddress address The new treasury address

setMeritCapMultiplier

function setMeritCapMultiplier(uint256 _meritCapMultiplier) external

Updates the merit cap multiplier

Parameters

Name Type Description
_meritCapMultiplier uint256 The new multiplier (e.g. 2 = 2x vote allocation)

seedDBARewardsForApps

function seedDBARewardsForApps(uint256[] _roundIds, bytes32[] _appIds, uint256[] _amounts) external

Seeds the reward amounts for multiple apps across multiple rounds (batch operation)

Parameters

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