Conversation
| function assignPublisherToCustomApp( | ||
| bytes32 appId, | ||
| address user | ||
| ) external onlyRoleOrAdmin(MODERATOR_ROLE) { | ||
| NewsStorage storage $ = _getNewsStorage(); | ||
| require( | ||
| !$.x2EarnApps.appExists(appId), | ||
| 'News: cannot assign publisher to VeBetterDAO app' | ||
| ); | ||
| _grantRole(PUBLISHER_ROLE, user); | ||
| $.appIdOfPublisher[user] = appId; | ||
| } | ||
|
|
||
| /** | ||
| * @dev Removes a publisher from an app | ||
| * @param user - the publisher address | ||
| */ | ||
| function removePublisherFromCustomApp( | ||
| address user | ||
| ) external onlyRoleOrAdmin(MODERATOR_ROLE) { | ||
| NewsStorage storage $ = _getNewsStorage(); | ||
| _revokeRole(PUBLISHER_ROLE, user); | ||
| delete $.appIdOfPublisher[user]; | ||
| } |
There was a problem hiding this comment.
Not totally sure about this one. It would allow anyone with a publisher role to publish by specifying an app ID which must not be an existing VBD app. The idea is to let VBD, vechain-kit, or anyone else publish their own news without needing to deploy or participate in VBD.
But it might be confusing in terms of smart contract validation and UX. The client could get revert reasons like “News: app does not exist” or “News: not app admin, creator or moderator,” which might be hard to interpret.
| function copySelectedFiles() { | ||
| filesToCopy.forEach((file) => { | ||
| const sourceFile = path.join(sourcePath, file.source); | ||
| const targetFile = path.join(targetPath, file.target); | ||
|
|
||
| if (!fs.existsSync(sourceFile)) { | ||
| throw new Error(`Source file not found: '${file.source}'`); | ||
| } | ||
|
|
||
| const targetDir = path.dirname(targetFile); | ||
| if (!fs.existsSync(targetDir)) { | ||
| throw new Error(`Target directory not found: '${targetDir}'`); | ||
| } | ||
|
|
||
| fs.copyFileSync(sourceFile, targetFile); | ||
| console.log(`✅ Copied ${file.source} to vechain-kit`); | ||
| }); | ||
| } |
There was a problem hiding this comment.
Not sure if this is the best approach , right now it's just copying the types to the static folder in vechain-kit right after compile. Maybe it'd make more sense to have a shared npm package with all the types we need, so it’s cleaner and avoid confusion. We could also use TypeChain’s externalArtifacts to get from external sources when needed.
|
Closing this for now since it’s not a priority. If needed, we can always reopen and continue from there. |
Description
This PR introduces the
Newscontract, allowing X2EarnApp admins and the vebetter DAO to emit news events and save it on storage. These events/storage can be consumed by client-side apps like the vebetter frontend, vechain-kit, and other internal tools by querying by appId for storage or filtering events by app id.TODOs
publishfunctionReset counter on new roundDecide: store full message on IPFS (emit CID) or on-chain?It was decided to be raw values on chainappIdmoderatefunction so VBD admin could remove published news or at least flag them as invalidCurrent Implementation deployed at https://insight.vecha.in/#/test/accounts/0x4b73A87567841cC261d1663499986488a21d4Ba0/
Updated packages (if any):