Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: node management, endorsing and gm #26

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 48 additions & 3 deletions CONTRACTS_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,63 @@ This document provides a detailed log of upgrades to the smart contract suite, e

| Date | Contract(s) | Summary |
| ------------------- | --------------------------------------------------------- | ----------------------------------------------------------- |
| 15th November 2024 | `X2EarnApps` version `2` | Added X2Earn Apps Vechain Node Endorsement feature |
| 21th October 2024 | `VeBetterPassport` version `2` | Check if the entity is a delegatee when request is created |
| 11th October 2024 | `XAllocationVoting` version `2` | Check isPerson when casting vote & fixed weight during vote |
| 11th October 2024 | `B3TRGovernor` version `4` | Check isPerson when casting vote |
| 11th October 2024 | `X2EarnRewardsPool` version `3` | Register action in VeBetter Passport contract |
| 27th September 2024 | `Emissions` version `2` | Aligned emissions with the expected schedule |
| 13th September 2024 | `B3TRGovernor` version `3`, `XAllocationPool` version `2` | Added toggling of quadratic voting and funding |
| 4th September 2024 | `X2EarnRewardsPool` version `2` | Added impact key management and proof building |
| 31st August 2024 | `VoterRewards` version `2` | Added quadratic rewarding features |
| 13th September 2024 | `B3TRGovernor` version `3`, `XAllocationPool` version `2` | - Added toggling of quadratic voting and funding |
| 4th September 2024 | `X2EarnRewardsPool` version `2` | - Added impact key management and proof building |
| 31st August 2024 | `VoterRewards` version `2` | - Added quadratic rewarding features |
| 29th August 2024 | `B3TRGovernor` version `2` | Updated access control modifiers |

---

## Upgrade `X2EarnApps` to Version 2

Added Vechain Node XApp Endorsement feature.

### Changes 🚀

- **Upgraded Contract(s):**
- `X2EarnApps.sol` to version `2`

### Storage Changes 📦

- **`EndorsementUpgradeable.sol`**:
- Added `_unendorsedApps` to store the list of apps pending endorsement.
- Added `_unendorsedAppsIndex` to store mapping from app ID to index in the \_unendorsedApps array.
- Added `_appEndorsers` to store the mapping of each app ID to an array of node IDs that have endorsed it.
- Added `_nodeEnodorsmentScore` to score the endorsement score for each node level.
- Added `_appGracePeriodStart` to store the grace period elapsed by the app since endorsed.
- Added `_nodeToEndorsedApp` to store the mapping of a node ID to the app it currently endorses.
- Added `_gracePeriodDuration` to store the grace period threshold for no endorsement in blocks.
- Added `_endorsementScoreThreshold` to store the endorsement score threshold for an app to be eligible for voting.
- Added `_appScores` to store the score of each app.
- Added `_appSecurity` to store the security score of each app.
- Added `_nodeManagementContract` to store the node management contract address.
- Added `_veBetterPassport` to store the VeBetterPassport contract address.
- **`EndorsementUpgradeable.sol`**:
- Added `_creators` to store a mapping of addresses that have a creators NFT and can manage interactions with Node holders for a specifc XApp.
- Added `_creatorApps` to store the number of apps created by a creator.
- Added `_x2EarnCreatorContract` to store the address of the X2Earn Creators contract.
- **`VoteEligibilityUpgradeable.sol`**:
- Added `_blackList` to store a record blacklisted X2Earn appIds.

### New Features 🚀

- Added `EndorsementUpgradeable.sol` module which makes up all X2EarnApps endorsement logic and functions (see docs for more info).
- Replaced `appApp()` with `submitApp()`.
- Added getter `isBlacklisted()` to check if XApp is blacklisted.
- Added `removeAppCreator()`, `appCreators()`, `isAppCreator()` and `creatorApps()` to manage and get info on X2Earn app creators.

### Bug Fixes 🐛

- - Added libraries `AdministrationUtils.sol`, `EndorsementUtils.sol`, `AppStorageUtils.sol` and `VoteEligibilityUtils.sol` to store some of the logic for the X2EarnApps contracts modules to reduce contract size.

---

## Upgrade `VeBetterPassport` to Version 2

Added check to ensure entity is not a delegatee or pending delegatee when making entity link request.
Expand Down
4 changes: 3 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ Our contracts are upgradeable and versioned. See the [contracts changelog](CONTR
"X2EarnRewardsPool": "0x6Bee7DDab6c99d5B2Af0554EaEA484CE18F52631",
"XAllocationPool": "0x4191776F05f4bE4848d3f4d587345078B439C7d3",
"XAllocationVoting": "0x89A00Bb0947a30FF95BEeF77a66AEdE3842Fe5B7",
"VeBetterPassport": "0x35a267671d8EDD607B2056A9a13E7ba7CF53c8b3"
"VeBetterPassport": "0x35a267671d8EDD607B2056A9a13E7ba7CF53c8b3",
"X2EarnCreator": "0xe8e96a768ffd00417d4bd985bec9EcfC6F732a7f",
"NodeManagement": "0xB0EF9D89C6b49CbA6BBF86Bf2FDf0Eee4968c6AB"
```

## Testnet contract addresses
Expand Down
8 changes: 8 additions & 0 deletions config/contracts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ export function getContractsConfig(env: EnvConfig) {
export function shouldRunSimulation() {
return process.env.NEXT_PUBLIC_APP_ENV == "local" && process.env.RUN_SIMULATION === "true"
}

export function shouldEndorseXApps() {
return process.env.ENDORSE_XAPPS === "true"
}

export function shouldNotUpgradeContracts() {
return process.env.DO_NOT_UPGRADE === "true"
}
6 changes: 4 additions & 2 deletions contracts/B3TRGovernor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ import { IVeBetterPassport } from "./interfaces/IVeBetterPassport.sol";
* - Added the ability to toggle the quadratic voting mechanism on and off
* ------------------ VERSION 4 ------------------
* - Integrated VeBetterPassport contract
* ------------------ VERSION 5 ------------------
* - Difference from V4: Updated all libraries to use new version of IVoterRewards that supports GM Upgrades.
*/
contract B3TRGovernor is
IB3TRGovernor,
Expand Down Expand Up @@ -573,7 +575,7 @@ contract B3TRGovernor is
* @return string The version of the governor
*/
function version() external pure returns (string memory) {
return "4";
return "5";
}

/**
Expand Down Expand Up @@ -612,7 +614,7 @@ contract B3TRGovernor is

/**
* @notice The voter rewards contract.
* @return IVoterRewards The voter rewards contract
* @return IVoterRewardsV2 The voter rewards contract
*/
function voterRewards() external view returns (IVoterRewards) {
GovernorStorageTypes.GovernorStorage storage $ = getGovernorStorage();
Expand Down
Loading
Loading