This contract handles the x-2-earn applications of the VeBetterDAO ecosystem. The contract allows the insert, management and eligibility of apps for the B3TR allocation rounds.
_The contract is using AccessControl to handle the admin and upgrader roles. Only users with the DEFAULT_ADMIN_ROLE can add new apps, set the base URI and set the voting eligibility for an app. Admins can also control the app metadata and management. Each app has a set of admins and moderators that can manage the app and settings.
——————– Version 2 ——————– - The contract has been upgraded to version 2 to include the X2Earn endorsement system. - Added libraries to reduce the contract size and improve readability.
——————– Version 3 ——————– - The contract has been upgraded to version 3 to add node cooldown period._
bytes32 UPGRADER_ROLE
The role that can upgrade the contract.
bytes32 GOVERNANCE_ROLE
The role that can manage the contract settings.
constructor() public
function initializeV3(uint48 _cooldownPeriod, address _xAllocationVotingGovernor) public
Initialize the version 3 contract
This function is called only once during the contract upgrade
Name | Type | Description |
---|---|---|
_cooldownPeriod | uint48 | the cooldown period for the endorsement |
_xAllocationVotingGovernor | address |
modifier onlyRoleAndAppAdmin(bytes32 role, bytes32 appId)
Modifier to restrict access to only the admin role and the app admin role.
Name | Type | Description |
---|---|---|
role | bytes32 | |
appId | bytes32 | the app ID |
modifier onlyRoleAndAppAdminOrModerator(bytes32 role, bytes32 appId)
Modifier to restrict access to only the admin role, the app admin role and the app moderator role.
Name | Type | Description |
---|---|---|
role | bytes32 | |
appId | bytes32 | the app ID |
function _authorizeUpgrade(address newImplementation) internal
_See {UUPSUpgradeable-authorizeUpgrade}
function version() public pure virtual returns (string)
Returns the version of the contract
This should be updated every time a new version of implementation is deployed
Name | Type | Description |
---|---|---|
[0] | string | sting The version of the contract |
function setBaseURI(string _baseURI) public
Update the base URI to retrieve the metadata of the x2earn apps
Name | Type | Description |
---|---|---|
_baseURI | string | the base URI for the contract Emits a {BaseURIUpdated} event. |
function setVotingEligibility(bytes32 _appId, bool _isEligible) public virtual
See {IX2EarnApps-setVotingEligibility}.
function submitApp(address _teamWalletAddress, address _admin, string _appName, string _appMetadataURI) public virtual
See {IX2EarnApps-submitApp}.
function setAppAdmin(bytes32 _appId, address _newAdmin) public
See {IX2EarnApps-setAppAdmin}.
function updateTeamWalletAddress(bytes32 _appId, address _newReceiverAddress) public
See {IX2EarnApps-updateTeamWalletAddress}.
function setTeamAllocationPercentage(bytes32 _appId, uint256 _percentage) public
See {IX2EarnApps-setTeamAllocationPercentage}.
function addAppModerator(bytes32 _appId, address _moderator) public
See {IX2EarnApps-addAppModerator}.
function removeAppModerator(bytes32 _appId, address _moderator) public
See {IX2EarnApps-removeAppModerator}.
function removeAppCreator(bytes32 _appId, address _creator) public
See {IX2EarnApps-removeAppCreator}.
function addRewardDistributor(bytes32 _appId, address _distributor) public
See {IX2EarnApps-addRewardDistributor}.
function addCreator(bytes32 _appId, address _creator) public
See {IX2EarnApps-addCreator}.
function removeRewardDistributor(bytes32 _appId, address _distributor) public
See {IX2EarnApps-removeRewardDistributor}.
function updateAppMetadata(bytes32 _appId, string _newMetadataURI) public
See {IX2EarnApps-updateAppMetadata}.
function updateGracePeriod(uint48 _newGracePeriod) public virtual
See {IX2EarnApps-updateGracePeriod}.
function updateCooldownPeriod(uint256 _newCooldownPeriod) public virtual
See {IX2EarnApps-updateCooldownPeriod}.
function updateNodeEndorsementScores(struct VechainNodesDataTypes.NodeStrengthScores _nodeStrengthScores) external
See {IX2EarnApps-updateNodeEndorsementScores}.
function updateEndorsementScoreThreshold(uint256 _scoreThreshold) external
See {IX2EarnApps-updateEndorsementScoreThreshold}.
function endorsementScoreThreshold() external view returns (uint256)
See {IX2EarnApps-endorsementScoreThreshold}.
function removeNodeEndorsement(bytes32 _appId, uint256 _nodeId) public virtual
See {IX2EarnApps-removeNodeEndorsement}.
function removeXAppSubmission(bytes32 _appId) public virtual
See {IX2EarnApps-removeXAppSubmission}.
function setNodeManagementContract(address _nodeManagementContract) public virtual
See {IX2EarnApps-setNodeManagementContract}.
function setVeBetterPassportContract(address _veBetterPassportContract) public virtual
See {IX2EarnApps-setVeBetterPassportContract}.
function setXAllocationVotingGovernor(address _xAllocationVotingGovernor) public virtual
See {IX2EarnApps-setXAllocationVotingGovernor}.
function setX2EarnCreatorContract(address _x2EarnCreatorContract) public
See {IX2EarnApps-setX2EarnCreatorContract}.