Skip to content

Update page.mdx#8793

Open
obadaibrahimelamairh-bit wants to merge 1 commit into
thirdweb-dev:mainfrom
obadaibrahimelamairh-bit:patch-1
Open

Update page.mdx#8793
obadaibrahimelamairh-bit wants to merge 1 commit into
thirdweb-dev:mainfrom
obadaibrahimelamairh-bit:patch-1

Conversation

@obadaibrahimelamairh-bit
Copy link
Copy Markdown

@obadaibrahimelamairh-bit obadaibrahimelamairh-bit commented Jun 8, 2026


PR-Codex overview

This PR transitions the content from a Markdown file related to accounts and wallets in the thirdweb SDK to a new smart contract written in Solidity, specifically for managing rewards in a recycling program.

Detailed summary

  • Removed metadata and introductory content about accounts and wallets.
  • Added a new Solidity contract named GreenbackReward that extends ERC1155 and AccessControl.
  • Introduced a VERIFIER_ROLE for granting rewards.
  • Implemented grantRecycleReward function to mint tokens based on verified images.
  • Added supportsInterface function to support interface checks.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

Release Notes

  • Documentation
    • Updated wallet documentation pages with smart contract code examples.
    • Added contract implementation showcasing token rewards functionality with role-based access control.
    • Contract supports minting reward tokens through verified accounts.

Signed-off-by: obadaibrahimelamairh-bit <289868488+obadaibrahimelamairh-bit@users.noreply.github.com>
@obadaibrahimelamairh-bit obadaibrahimelamairh-bit requested review from a team as code owners June 8, 2026 18:45
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 8, 2026

⚠️ No Changeset found

Latest commit: 7c2a813

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel vercel Bot temporarily deployed to Preview – nebula June 8, 2026 18:45 Inactive
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated (UTC)
nebula Skipped Skipped Jun 8, 2026 6:46pm
thirdweb_playground Skipped Skipped Jun 8, 2026 6:46pm
thirdweb-www Skipped Skipped Jun 8, 2026 6:46pm
wallet-ui Skipped Skipped Jun 8, 2026 6:46pm

@vercel vercel Bot temporarily deployed to Preview – thirdweb_playground June 8, 2026 18:45 Inactive
@vercel vercel Bot temporarily deployed to Preview – thirdweb-www June 8, 2026 18:45 Inactive
@vercel vercel Bot temporarily deployed to Preview – wallet-ui June 8, 2026 18:45 Inactive
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 8, 2026

@obadaibrahimelamairh-bit is attempting to deploy a commit to the thirdweb Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the Portal Involves changes to the Portal (docs) codebase. label Jun 8, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 8, 2026

Review Change Stack

Walkthrough

A documentation page for "Accounts & Wallets" in the TypeScript v5 section was replaced with a Solidity smart contract example. The new GreenbackReward contract implements ERC1155 multi-token and access control, defining a verifier role with gated minting permissions and metadata URI configuration.

Changes

GreenbackReward Contract

Layer / File(s) Summary
GreenbackReward ERC1155 contract with role-based access control
apps/portal/src/app/typescript/v5/wallets/page.mdx
Complete contract replaces prior documentation: defines VERIFIER_ROLE and RECYCLE_TOKEN constants, initializes ERC1155 URI in constructor, restricts grantRecycleReward minting to VERIFIER_ROLE members, and overrides supportsInterface to declare ERC1155 and AccessControl compliance.

Sequence Diagram(s)

No sequence diagram necessary for this change: it is a documentation file replacement containing a simple, self-contained contract example without multi-component interactions or complex control flow.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only contains an empty PR template comment and an auto-generated PR-Codex summary; the author did not fill in required sections like notes for reviewer, testing instructions, or issue tag. Complete the PR template by filling in the issue tag (TEAM-0000 format), notes for the reviewer, and testing instructions as specified in the repository template.
Title check ❓ Inconclusive The title is vague and generic, using only 'Update page.mdx' without describing what was actually changed in the file. Provide a more descriptive title that reflects the main change, such as '[Portal] Feature: Add GreenbackReward smart contract' or similar.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Warning

⚠️ This pull request might be slop. It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/portal/src/app/typescript/v5/wallets/page.mdx (1)

14-16: 💤 Low value

No initial verifiers granted - contract requires additional setup after deployment.

Assuming this contract were placed in the correct location: the constructor only grants DEFAULT_ADMIN_ROLE to the deployer. While the admin can subsequently call grantRole(VERIFIER_ROLE, address) (inherited from AccessControl), no initial verifiers are set up. Consider either:

  1. Accepting a verifier address in the constructor, or
  2. Adding documentation/comments clarifying the post-deployment setup required

This is a secondary concern given that the primary issue is this Solidity code replacing documentation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/portal/src/app/typescript/v5/wallets/page.mdx` around lines 14 - 16, The
constructor currently only grants DEFAULT_ADMIN_ROLE to msg.sender leaving
VERIFIER_ROLE empty; either accept an initial verifier address in the
constructor or add explicit docs/comments describing required post-deploy setup.
To fix in code, change the constructor signature (constructor(address
initialVerifier) or constructor(address[] memory initialVerifiers)) and call
_grantRole(VERIFIER_ROLE, initialVerifier) (or loop for multiple) after
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender); alternatively, add a clear NatSpec
comment above the constructor mentioning that deployer must call
grantRole(VERIFIER_ROLE, address) (or grantRole for each verifier) after
deployment and show an example call using grantRole/VERIFIER_ROLE so integrators
know the required setup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/portal/src/app/typescript/v5/wallets/page.mdx`:
- Around line 1-29: This MDX doc was accidentally replaced by a Solidity
contract (GreenbackReward with symbols like grantRecycleReward, RECYCLE_TOKEN,
constructor); revert this file to the original TypeScript SDK wallet
documentation content for the v5 wallets page, and move the Solidity code into
the appropriate contracts directory as a .sol file (e.g., create a new
GreenbackReward.sol) so it no longer breaks MDX parsing and documentation links;
ensure references from other docs still point to the restored MDX and update the
repo structure so smart-contract code is stored with .sol files, not in the MDX
documentation.

---

Nitpick comments:
In `@apps/portal/src/app/typescript/v5/wallets/page.mdx`:
- Around line 14-16: The constructor currently only grants DEFAULT_ADMIN_ROLE to
msg.sender leaving VERIFIER_ROLE empty; either accept an initial verifier
address in the constructor or add explicit docs/comments describing required
post-deploy setup. To fix in code, change the constructor signature
(constructor(address initialVerifier) or constructor(address[] memory
initialVerifiers)) and call _grantRole(VERIFIER_ROLE, initialVerifier) (or loop
for multiple) after _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); alternatively,
add a clear NatSpec comment above the constructor mentioning that deployer must
call grantRole(VERIFIER_ROLE, address) (or grantRole for each verifier) after
deployment and show an example call using grantRole/VERIFIER_ROLE so integrators
know the required setup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 020d79c8-eb0c-4fb9-83b9-36703a1ddc07

📥 Commits

Reviewing files that changed from the base of the PR and between 50420fc and 7c2a813.

📒 Files selected for processing (1)
  • apps/portal/src/app/typescript/v5/wallets/page.mdx

Comment on lines +1 to +29
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

contract GreenbackReward is ERC1155, AccessControl {
// دور خاص للمُحققين الذين سيراجعون الصور
bytes32 public constant VERIFIER_ROLE = keccak256("VERIFIER_ROLE");

// معرف الرمز الخاص بنقاط إعادة التدوير
uint256 public constant RECYCLE_TOKEN = 1;

constructor() ERC1155("https://api.greenback.io/tokens/{id}.json") {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
}

// دالة منح المكافأة: تُستخدم فقط من قِبل المُحققين بعد مراجعة الصورة
function grantRecycleReward(address user, uint256 quantity) public onlyRole(VERIFIER_ROLE) {
// كل وحدة تدوير (صورة) تساوي 10 نقاط
uint256 rewardAmount = quantity * 10;
_mint(user, RECYCLE_TOKEN, rewardAmount, "");
}

// دالة لدعم الواجهات البرمجية
function supportsInterface(bytes4 interfaceId) public view override(ERC1155, AccessControl) returns (bool) {
return super.supportsInterface(interfaceId);
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical: Documentation page replaced with unrelated Solidity contract code.

This PR replaces the TypeScript SDK wallet documentation (/typescript/v5/wallets) with a Solidity smart contract. This is problematic for several reasons:

  1. Wrong file type: This is an .mdx file meant for documentation. Raw Solidity code will cause MDX parsing errors.
  2. Breaks documentation links: Other documentation pages (e.g., send/page.mdx, migrate/page.mdx) link to this route expecting wallet documentation.
  3. Content mismatch: The file path typescript/v5/wallets/page.mdx is clearly for TypeScript SDK documentation, not a Solidity contract.

This change should be reverted. If the GreenbackReward contract is intended to be added to the repository, it belongs in a different location (likely a contracts directory with a .sol extension).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/portal/src/app/typescript/v5/wallets/page.mdx` around lines 1 - 29, This
MDX doc was accidentally replaced by a Solidity contract (GreenbackReward with
symbols like grantRecycleReward, RECYCLE_TOKEN, constructor); revert this file
to the original TypeScript SDK wallet documentation content for the v5 wallets
page, and move the Solidity code into the appropriate contracts directory as a
.sol file (e.g., create a new GreenbackReward.sol) so it no longer breaks MDX
parsing and documentation links; ensure references from other docs still point
to the restored MDX and update the repo structure so smart-contract code is
stored with .sol files, not in the MDX documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Portal Involves changes to the Portal (docs) codebase.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant