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_
bytes32 ROUND_STARTER_ROLE
Role identifier for the address that can start a new round
bytes32 UPGRADER_ROLE
Role identifier for the address that can upgrade the contract
bytes32 GOVERNANCE_ROLE
Role identifier for governance operations
bytes32 CONTRACTS_ADDRESS_MANAGER_ROLE
The role that can set the addresses of the contracts used by the VoterRewards contract.
Data for initializing the contract
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() public
function initialize(struct XAllocationVoting.InitializationData data) public
Initialize the contract
Name | Type | Description |
---|---|---|
data | struct XAllocationVoting.InitializationData | The initialization data |
function initializeV2(contract IVeBetterPassport _veBetterPassport) public
function setX2EarnAppsAddress(contract IX2EarnApps newX2EarnApps) external
Set the address of the X2EarnApps contract
function setEmissionsAddress(contract IEmissions newEmissions) external
Set the address of the Emissions contract
function setVoterRewardsAddress(contract IVoterRewards newVoterRewards) external
Set the address of the VoterRewards contract
function setVotingThreshold(uint256 newVotingThreshold) public virtual
_Update the voting threshold. This operation can only be performed through a governance proposal.
Emits a {VotingThresholdSet} event._
function startNewRound() public returns (uint256)
Start a new voting round for allocating funds to the x-apps
function setAppSharesCap(uint256 appSharesCap_) external virtual
Set the max amount of shares an app can get in a round
function setBaseAllocationPercentage(uint256 baseAllocationPercentage_) public virtual
Set the base allocation percentage for funds distribution in a round
function setVotingPeriod(uint32 newVotingPeriod) public virtual
Set the voting period for a round
function updateQuorumNumerator(uint256 newQuorumNumerator) public virtual
Update the quorum a round needs to reach to be successful
function setVeBetterPassport(contract IVeBetterPassport newVeBetterPassport) external
Set the VeBetterPassport contract
function roundQuorum(uint256 roundId) external view returns (uint256)
Returns the quorum for a given round
function votingPeriod() public view returns (uint256)
function quorum(uint256 blockNumber) public view returns (uint256)
function supportsInterface(bytes4 interfaceId) public view returns (bool)
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 {}
_