Skip to content

style(repo): cosmetic readability cleanups across docs, scripts, and onramp additions#82

Open
5ran6 wants to merge 3 commits intomainfrom
agent/cosmetic-cleanups-22ee
Open

style(repo): cosmetic readability cleanups across docs, scripts, and onramp additions#82
5ran6 wants to merge 3 commits intomainfrom
agent/cosmetic-cleanups-22ee

Conversation

@5ran6
Copy link
Copy Markdown
Contributor

@5ran6 5ran6 commented Apr 13, 2026

Description

This PR applies non-functional, cosmetic cleanups to improve readability and consistency across docs, scripts, config, tests, and newly added onramp-related code introduced on main.

Background and impact:

  • The codebase behavior is intentionally unchanged.
  • Updates focus on formatting consistency, typo/message cleanup, clearer naming, and documentation/comment quality.
  • No API, protocol logic, or feature behavior changes were introduced.

Implementation details:

  • README.md
    • Corrected owner-configuration script command names to match existing files.
    • Updated testing path wording to use test/.
    • Removed minor whitespace noise.
  • scripts/deploy.ts
    • Clarified direct deployment log output (Contract Address instead of Proxy Contract Address).
    • Minor indentation cleanup.
  • scripts/upgrade.ts
    • Fixed typo in error string formatting.
    • Normalized indentation/comments for readability.
  • scripts/setTokenFeeSettings.ts, scripts/setSupportedTokens.ts
    • Corrected fallback gas comments (90 Gwei).
  • hardhat.config.ts
    • Added missing semicolon in the legacy config path and preserved upstream config structure while resolving sync conflicts.
  • test/gateway/gateway.ownable.test.js
    • Minor local variable naming cleanup for readability.

Additional updates after syncing latest main (onramp additions):

  • contracts/interfaces/IGateway.sol
    • Improved NatSpec wording and indentation for OrderCreated and settleIn docs.
    • Improved SettleIn event comment formatting.
  • contracts/Gateway.sol
    • Removed unused local fee struct.
    • Aligned a few comments/whitespace for clarity (no logic changes).
  • tasks/accounts.ts
    • Removed unused task argument naming noise and simplified comments/indentation.
  • tasks/flatten.ts
    • Minor readability polish (?? defaulting, wrapped long replace call, explicit callback type).

Breaking changes: None.

Alternatives considered:

  • Running broad auto-formatting across the entire repository was avoided to keep this PR focused and easy to review.

References

N/A

Testing

Validation performed:

  • Manual diff review to ensure only cosmetic/non-functional edits.
  • Verified branch sync with latest main and re-applied cosmetic updates on top of the new onramp feature files.

Environment:

  • Linux (cloud agent)
  • Node/Hardhat project context

Notes:

  • Test execution was not completed in this environment due to missing local Hardhat dependencies (HHE22 non-local installation error).

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not main

By submitting a PR, I agree to Paycrest's Contributor Code of Conduct and Contribution Guide.

Open in Web Open in Cursor 

Summary by CodeRabbit

  • Documentation

    • Updated README with script command references and test directory notation.
  • Chores

    • Cleaned up code formatting and whitespace across configuration and script files.
    • Updated deployment output messaging.
    • Refined task logic for improved default parameter handling.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

📝 Walkthrough

Walkthrough

This PR consolidates minor code quality improvements across documentation, configuration, and scripts. Changes include updating README references from deprecated updateProtocolFee to setTokenFeeSettings, removing unused struct definitions, standardizing formatting and whitespace throughout contracts and configuration files, improving nullish coalescing logic, and renaming test variables for clarity.

Changes

Cohort / File(s) Summary
Documentation and Configuration
README.md, hardhat.config.ts
Updated script references in README from updateProtocolFee to setTokenFeeSettings; fixed whitespace, added missing semicolon, and appended newline in Hardhat config.
Core Contracts
contracts/Gateway.sol, contracts/interfaces/IGateway.sol
Removed unused fee struct; corrected comments and formatting in Gateway.sol; updated NatSpec documentation and reformatted event/function declarations in IGateway.sol without signature changes.
Deployment and Fee Configuration Scripts
scripts/deploy.ts, scripts/setSupportedTokens.ts, scripts/setTokenFeeSettings.ts, scripts/upgrade.ts
Normalized whitespace and indentation across all scripts; updated Polygon and Celo gas fee fallback comments from 30 Gwei to 90 Gwei; adjusted deployment output message text.
Task Utilities
tasks/accounts.ts, tasks/flatten.ts
Renamed signer parameter to indicate unused status; improved nullish coalescing operator usage in flatten.ts to distinguish between empty array and undefined; refined regex callback typing.
Test Suite
test/gateway/gateway.ownable.test.js
Renamed signer and result variables from PascalCase to camelCase for consistency and semantic clarity without changing test logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • feat: new fee structure #70: Introduces token-specific fee settings and the new setTokenFeeSettings API referenced in this PR's README and script updates.

Suggested reviewers

  • chibie
  • onahprosper

Poem

🐰✨ With tidying whiskers and a hop-full of care,
We dust off the code from the lint in the air—
Old structs now departed, formatting bright,
The rabbits polish each comment just right! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 clearly and concisely summarizes the main change: cosmetic readability cleanups across multiple areas (docs, scripts, and onramp additions), which accurately reflects the changeset's nature and scope.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/cosmetic-cleanups-22ee

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.

@cursor cursor bot changed the title style(repo): cosmetic readability cleanups across docs and scripts style(repo): cosmetic readability cleanups across docs, scripts, and onramp additions Apr 13, 2026
@5ran6 5ran6 marked this pull request as ready for review April 13, 2026 22:24
@cursor
Copy link
Copy Markdown

cursor bot commented Apr 13, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Copy link
Copy Markdown

@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)
test/gateway/gateway.ownable.test.js (1)

44-45: Variable naming could be more precise.

While unsupportedToken is more descriptive than Alice, it's semantically imprecise since the variable holds a boolean result, not a token. Consider inlining the call or using a name like isSupported.

♻️ Optional refactor to inline the call
-    const unsupportedToken = await gateway.isTokenSupported(alice.address);
-    expect(unsupportedToken).to.eq(false);
+    expect(await gateway.isTokenSupported(alice.address)).to.eq(false);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/gateway/gateway.ownable.test.js` around lines 44 - 45, Rename the
boolean variable `unsupportedToken` to something that reflects its boolean
nature (e.g., `isSupported`) or inline the call; specifically update the
assertion using `gateway.isTokenSupported` (the call in the test) so it either
uses `const isSupported = await gateway.isTokenSupported(alice.address);
expect(isSupported).to.eq(false);` or directly `expect(await
gateway.isTokenSupported(alice.address)).to.eq(false);` to remove the misleading
“token” noun and make the test intent clearer.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tasks/accounts.ts`:
- Around line 15-20: The console.log prints provider.getBalance(account.address)
(wei) but labels it as ETH; update the logging to convert wei → ETH before
printing by calling the appropriate formatter (e.g., ethers.utils.formatEther)
on the result of provider.getBalance(account.address) and use that formatted
value in the console.log that references account.address so the output shows the
balance in ETH units.

---

Nitpick comments:
In `@test/gateway/gateway.ownable.test.js`:
- Around line 44-45: Rename the boolean variable `unsupportedToken` to something
that reflects its boolean nature (e.g., `isSupported`) or inline the call;
specifically update the assertion using `gateway.isTokenSupported` (the call in
the test) so it either uses `const isSupported = await
gateway.isTokenSupported(alice.address); expect(isSupported).to.eq(false);` or
directly `expect(await gateway.isTokenSupported(alice.address)).to.eq(false);`
to remove the misleading “token” noun and make the test intent clearer.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: bc7a759e-722b-41a8-85db-e064b5b3d6b2

📥 Commits

Reviewing files that changed from the base of the PR and between e692e7d and 70281a8.

📒 Files selected for processing (11)
  • README.md
  • contracts/Gateway.sol
  • contracts/interfaces/IGateway.sol
  • hardhat.config.ts
  • scripts/deploy.ts
  • scripts/setSupportedTokens.ts
  • scripts/setTokenFeeSettings.ts
  • scripts/upgrade.ts
  • tasks/accounts.ts
  • tasks/flatten.ts
  • test/gateway/gateway.ownable.test.js

Comment thread tasks/accounts.ts
Comment on lines +15 to +20
console.log(
"%s (%i ETH)",
account.address,
// getBalance returns wei amount.
await provider.getBalance(account.address)
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix balance unit mismatch in account logs.

Line 16 labels the value as ETH, but Line 18/Line 19 pass a wei amount. This can mislead operators reading task output.

💡 Proposed fix
-    console.log(
-      "%s (%i ETH)",
-      account.address,
-      // getBalance returns wei amount.
-      await provider.getBalance(account.address)
-    );
+    const balanceWei = await provider.getBalance(account.address);
+    console.log("%s (%s wei)", account.address, balanceWei.toString());
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
console.log(
"%s (%i ETH)",
account.address,
// getBalance returns wei amount.
await provider.getBalance(account.address)
);
const balanceWei = await provider.getBalance(account.address);
console.log("%s (%s wei)", account.address, balanceWei.toString());
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tasks/accounts.ts` around lines 15 - 20, The console.log prints
provider.getBalance(account.address) (wei) but labels it as ETH; update the
logging to convert wei → ETH before printing by calling the appropriate
formatter (e.g., ethers.utils.formatEther) on the result of
provider.getBalance(account.address) and use that formatted value in the
console.log that references account.address so the output shows the balance in
ETH units.

Comment thread contracts/Gateway.sol
*/
contract Gateway is IGateway, GatewaySettingManager, PausableUpgradeable {
using SafeERC20 for IERC20;
struct fee {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can only add a comment to show that this is a deprecated variable instead of removing/deleting it cause this is an upgradeable contract.

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