Solidity API

DBAPool

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

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;
}

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

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

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.

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

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

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