Skip to content

Conversation

@fadeev
Copy link
Member

@fadeev fadeev commented Oct 24, 2025

Based on changes in zeta-chain/example-contracts#299

Summary by CodeRabbit

  • Documentation
    • Simplified contract interfaces by removing gateway initialization requirements.
    • Clarified gas fee handling workflow with updated approval patterns.
    • Updated deployment commands and code examples across developer tutorials.
    • Improved registry access patterns and registry structure examples.
    • Refined NFT and token standards deployment instructions.

@vercel
Copy link

vercel bot commented Oct 24, 2025

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

Project Deployment Preview Updated (UTC)
docs-v2 Ready Ready Preview Oct 24, 2025 11:07am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 24, 2025

📝 Walkthrough

Walkthrough

Documentation updates across multiple developer guides remove Uniswap router and gateway configuration from deployment commands, update gas fee handling workflows in code examples, transition from GatewayZEVM to UniversalContract interface, and rename entrypoint from on_call to onCall.

Changes

Cohort / File(s) Summary
Deployment Configuration Cleanup
src/pages/developers/standards/nft.mdx, src/pages/developers/standards/token.mdx
Fixed spacing in ZRC20_BASE token lookup commands. Removed UNISWAP_ROUTER variable declarations and --uniswap-router flag usage. Removed --gateway $GATEWAY_ZETACHAIN parameter from deployment commands.
Gas Fee Handling Workflow Updates
src/pages/developers/tutorials/call.mdx
Updated outgoing call flow documentation to include gas fee quoting, pulling from caller, and gateway approval. Added Solidity code snippet for gas fee withdrawal with gas limits. Updated forge create commands by removing --json flag. Modified registry access query to retrieve gas token by coinType field.
Entrypoint Naming & Logic Refinements
src/pages/developers/tutorials/swap.mdx
Renamed on_call entrypoint to onCall. Added conditional notes for gas swapping logic when withdrawing to connected chains. Added guidance on combined allowance handling when destination gas token matches target token.
Contract Interface Migration
src/pages/developers/tutorials/hello.mdx
Replaced GatewayZEVM import with UniversalContract interface. Removed gateway state variable and constructor initializing it. Removed onlyGateway modifier and enforcement logic. Simplified deployment snippets by removing constructor arguments. Updated narrative documentation to reflect architectural changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • GatewayZEVM removal consistency: Verify the UniversalContract interface properly replaces all GatewayZEVM functionality across hello.mdx and confirm this aligns with actual contract implementation.
  • Gas fee workflow correctness: Validate the updated gas fee handling steps in call.mdx and swap.mdx match the current protocol implementation for fee quoting, approval, and execution.
  • Registry access pattern: Confirm the updated jq expression for retrieving gas tokens (filtering by coinType and originChainId) is accurate for the current registry structure.
  • Deployment command accuracy: Cross-reference removed parameters (Uniswap router, gateway) against current deployment requirements to ensure no valid configurations were accidentally removed.

Possibly related PRs

  • Swap tutorial rewrite #688: Modifies swap.mdx with identical onCall entrypoint renaming and overlapping gas-fee/swap logic updates, indicating coordinated protocol changes.

Suggested reviewers

  • swift1337

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Update tutorials to use the new streamlined abstract UniversalContract-based examples" accurately captures the primary objective of the changeset. The most significant modifications are in the tutorials files (hello.mdx, call.mdx, swap.mdx), where the documentation is updated to reflect a shift from GatewayZEVM-based patterns to UniversalContract-based abstractions. This aligns with the stated PR objective referencing example-contracts changes. While the changeset also includes updates to standards documentation files (nft.mdx, token.mdx) with parameter cleanup and spacing corrections, these appear to be supporting adjustments rather than the central focus. The title appropriately highlights the main architectural change without requiring exhaustive coverage of all modifications.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tutorials-use-abstract-universal-contract

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d425175 and dbf4f18.

📒 Files selected for processing (5)
  • src/pages/developers/standards/nft.mdx (1 hunks)
  • src/pages/developers/standards/token.mdx (1 hunks)
  • src/pages/developers/tutorials/call.mdx (4 hunks)
  • src/pages/developers/tutorials/hello.mdx (4 hunks)
  • src/pages/developers/tutorials/swap.mdx (4 hunks)
🔇 Additional comments (10)
src/pages/developers/standards/nft.mdx (2)

62-62: Minor fix: Token query flag spacing corrected.

The ZRC20_BASE query now properly positions the -f zrc20 flag immediately following -s ETH.BASESEP, improving command consistency and copy-paste reliability.


78-113: Gateway removal from ZetaChain deployments: verify intentional scope.

The ZetaChain NFT deployment (line 78–82) no longer includes --gateway $GATEWAY_ZETACHAIN, while EVM connected-chain deployments on Base (lines 90–95) and Ethereum (lines 103–108) retain --gateway flags. This pattern suggests the contract interface change decouples ZetaChain deployments from explicit gateway wiring at deploy time. Confirm this is intentional and that the onlyGateway enforcement (or equivalent) is now inherited or implicit in the UniversalContract interface across all three chains.

src/pages/developers/tutorials/swap.mdx (2)

35-36: Clarified gas token handling edge cases and conditional withdrawal logic.

Three enhancements improve precision of the gas-fee workflow:

  1. Lines 35–36: Step 4 now explicitly conditions gas swaps on "withdrawing to a connected chain," which aligns with the contract logic that skips gas swaps for local-chain transfers. This is clearer.
  2. Lines 148–150: New note clarifies that when gasZRC20 equals the target token, a single combined allowance (out + gasFee) replaces two separate approvals. Verify this edge case is correctly implemented in the referenced contract.
  3. Lines 267–268: New note clarifies that when inputToken == gasZRC20, no gas swap is required and only the remainder is swapped to target. This prevents double-accounting and improves gas efficiency.

Also applies to: 148-150, 267-269


96-96: Entrypoint naming and modifier inheritance updated: verify documentation alignment.

  • Line 96: Heading now uses onCall (camelCase, modern Solidity convention).
  • Line 103: Function signature shows onCall with onlyGateway modifier.
  • Line 111: Text states modifier is inherited from UniversalContract, but line 103 shows it explicitly declared.

Clarify whether onlyGateway is inherited from UniversalContract interface or explicitly declared in Swap contract. If inherited, the Solidity code snippet should not show it in the function signature. If explicitly declared, update the narrative.

Also applies to: 103-103, 111-111

src/pages/developers/standards/token.mdx (1)

77-100: Gateway removal pattern consistent with NFT standard.

Token standard deployment mirrors NFT standard changes: ZetaChain deployment (lines 77–82) omits --gateway $GATEWAY_ZETACHAIN, while EVM connected-chain deployments (Base, Ethereum) retain gateway flags. This consistency across standards is positive. Confirm this pattern is intentional and matches the updated contract interface across all Universal standards (token, NFT, etc.).

src/pages/developers/tutorials/call.mdx (3)

91-98: Gas-fee handling workflow clearly specified: quote → pull → approve pattern.

Lines 91–98 explicitly document a three-step workflow for outgoing calls:

  1. Quote destination gas fee using withdrawGasFeeWithGasLimit(callOptions.gasLimit).
  2. Pull the fee from caller via transferFrom(msg.sender, address(this), gasFee).
  3. Approve Gateway to spend it via approve(address(gateway), gasFee).

This replaces simpler prior approvals and makes the flow transparent. The update is correct and improves clarity. Verify that withdrawGasFeeWithGasLimit() is the canonical method in the current IZRC20 interface.


454-457: Registry query updated for precision: filter by gas token type and origin chain.

Line 455 updates the jq expression to select gas tokens by both coinType == "gas" and originChainId == "11155112", replacing a simpler gasZRC20 field lookup. This is more explicit and resilient to registry schema changes. Confirm the registry structure supports both .coinType and .originChainId fields as expected.


286-286: Inconsistency: AI summary claims --json flag removal, but code retains it.

The AI-generated summary states: "forge create commands no longer include the --json flag." However:

  • Line 286 shows forge create ... --json | jq -r .deployedTo (still present).
  • Line 467 shows forge create ... --json | jq -r .deployedTo (still present).

Clarify whether the flag should be removed or retained. If removal is intentional, update these lines. If retention is correct, note the summary is misleading.

Also applies to: 467-467

src/pages/developers/tutorials/hello.mdx (2)

65-74: Potential inconsistency: onlyGateway modifier inheritance vs. explicit declaration.

  • Line 70: The onCall function signature explicitly declares external override onlyGateway.
  • Lines 96–97: The narrative states this modifier "is inherited from UniversalContract."

If onlyGateway is truly inherited, it should not appear explicitly in the function signature. If it is explicitly declared, the narrative should clarify that fact. Verify the actual contract architecture: does UniversalContract provide the modifier as an inherited abstract definition, or is it a concrete modifier that must be declared on each function?

Also applies to: 96-97


154-163: Deployment command flag inconsistency with AI summary.

The AI summary claims forge create commands "no longer include the --json flag," but:

  • Line 162 (Localnet): forge create Universal ... --json | jq -r .deployedTo (flag present).
  • Line 231 (Testnet): forge create Universal ... --json | jq -r .deployedTo (flag present).

Clarify whether --json should be retained or removed. If it should be removed to align with the summary, update both occurrences. If it should be retained, note that the summary is incorrect.

Also applies to: 224-232


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.

@fadeev fadeev marked this pull request as ready for review October 27, 2025 10:15
@fadeev fadeev requested review from a team as code owners October 27, 2025 10:15
Copy link
Member

@hernan-clich hernan-clich left a comment

Choose a reason for hiding this comment

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

Concept ACK

@fadeev fadeev merged commit 30ecdfb into main Oct 27, 2025
7 checks passed
@fadeev fadeev deleted the tutorials-use-abstract-universal-contract branch October 27, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants