Solidity API

XAllocationVoting

This contract handles the voting for the most supported x2Earn applications through periodic allocation rounds. The user’s voting power is calculated on his VOT3 holdings at the start of each round, using a “Quadratic Funding” formula.

_Rounds are started by the Emissions contract. Interacts with the X2EarnApps contract to get the app data (eg: app IDs, app existence, eligible apps for each round). Interacts with the VotingRewards contract to save the user from casting a vote. The contract is using AccessControl to handle roles for admin, governance, and round-starting operations.

—– Version 2 —– - Integrated VeBetterPassport - Added check to ensure that the vote weight for an XApp cast by a user is greater than the voting threshold

—– Version 3 —– - Updated the X2EarnApps interface to support node endorsement feature

—– Version 4 —– - Updated the X2EarnApps interface to support node cooldown functionality_

ROUND_STARTER_ROLE

bytes32 ROUND_STARTER_ROLE

Role identifier for the address that can start a new round

UPGRADER_ROLE

bytes32 UPGRADER_ROLE

Role identifier for the address that can upgrade the contract

GOVERNANCE_ROLE

bytes32 GOVERNANCE_ROLE

Role identifier for governance operations

CONTRACTS_ADDRESS_MANAGER_ROLE

bytes32 CONTRACTS_ADDRESS_MANAGER_ROLE

The role that can set the addresses of the contracts used by the VoterRewards contract.

InitializationData

Data for initializing the contract

Parameters

Name Type Description
struct InitializationData {
  contract IVotes vot3Token;
  uint256 quorumPercentage;
  uint32 initialVotingPeriod;
  address timeLock;
  contract IVoterRewards voterRewards;
  contract IEmissions emissions;
  address[] admins;
  address upgrader;
  address contractsAddressManager;
  contract IX2EarnApps x2EarnAppsAddress;
  uint256 baseAllocationPercentage;
  uint256 appSharesCap;
  uint256 votingThreshold;
}

constructor

constructor() public

initialize

function initialize(struct XAllocationVoting.InitializationData data) public

Initialize the contract

Parameters

Name Type Description
data struct XAllocationVoting.InitializationData The initialization data

initializeV2

function initializeV2(contract IVeBetterPassport _veBetterPassport) public

setX2EarnAppsAddress

function setX2EarnAppsAddress(contract IX2EarnApps newX2EarnApps) external

Set the address of the X2EarnApps contract

setEmissionsAddress

function setEmissionsAddress(contract IEmissions newEmissions) external

Set the address of the Emissions contract

setVoterRewardsAddress

function setVoterRewardsAddress(contract IVoterRewards newVoterRewards) external

Set the address of the VoterRewards contract

setVotingThreshold

function setVotingThreshold(uint256 newVotingThreshold) public virtual

_Update the voting threshold. This operation can only be performed through a governance proposal.

Emits a {VotingThresholdSet} event._

startNewRound

function startNewRound() public returns (uint256)

Start a new voting round for allocating funds to the x-apps

setAppSharesCap

function setAppSharesCap(uint256 appSharesCap_) external virtual

Set the max amount of shares an app can get in a round

setBaseAllocationPercentage

function setBaseAllocationPercentage(uint256 baseAllocationPercentage_) public virtual

Set the base allocation percentage for funds distribution in a round

setVotingPeriod

function setVotingPeriod(uint32 newVotingPeriod) public virtual

Set the voting period for a round

updateQuorumNumerator

function updateQuorumNumerator(uint256 newQuorumNumerator) public virtual

Update the quorum a round needs to reach to be successful

setVeBetterPassport

function setVeBetterPassport(contract IVeBetterPassport newVeBetterPassport) external

Set the VeBetterPassport contract

roundQuorum

function roundQuorum(uint256 roundId) external view returns (uint256)

Returns the quorum for a given round

votingPeriod

function votingPeriod() public view returns (uint256)

quorum

function quorum(uint256 blockNumber) public view returns (uint256)

supportsInterface

function supportsInterface(bytes4 interfaceId) public view returns (bool)

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal

_Function that should revert when msg.sender is not authorized to upgrade the contract. Called by {upgradeToAndCall}.

Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.

solidity function _authorizeUpgrade(address) internal onlyOwner {}_