style(repo): cosmetic readability cleanups across docs, scripts, and onramp additions#82
style(repo): cosmetic readability cleanups across docs, scripts, and onramp additions#82
Conversation
Co-authored-by: Francis Ocholi <[email protected]>
📝 WalkthroughWalkthroughThis PR consolidates minor code quality improvements across documentation, configuration, and scripts. Changes include updating README references from deprecated Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Co-authored-by: Francis Ocholi <[email protected]>
Co-authored-by: Francis Ocholi <[email protected]>
|
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. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/gateway/gateway.ownable.test.js (1)
44-45: Variable naming could be more precise.While
unsupportedTokenis more descriptive thanAlice, it's semantically imprecise since the variable holds a boolean result, not a token. Consider inlining the call or using a name likeisSupported.♻️ 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
📒 Files selected for processing (11)
README.mdcontracts/Gateway.solcontracts/interfaces/IGateway.solhardhat.config.tsscripts/deploy.tsscripts/setSupportedTokens.tsscripts/setTokenFeeSettings.tsscripts/upgrade.tstasks/accounts.tstasks/flatten.tstest/gateway/gateway.ownable.test.js
| console.log( | ||
| "%s (%i ETH)", | ||
| account.address, | ||
| // getBalance returns wei amount. | ||
| await provider.getBalance(account.address) | ||
| ); |
There was a problem hiding this comment.
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.
| 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.
| */ | ||
| contract Gateway is IGateway, GatewaySettingManager, PausableUpgradeable { | ||
| using SafeERC20 for IERC20; | ||
| struct fee { |
There was a problem hiding this comment.
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.
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:
Implementation details:
README.mdtest/.scripts/deploy.tsContract Addressinstead ofProxy Contract Address).scripts/upgrade.tsscripts/setTokenFeeSettings.ts,scripts/setSupportedTokens.ts90 Gwei).hardhat.config.tstest/gateway/gateway.ownable.test.jsAdditional updates after syncing latest
main(onramp additions):contracts/interfaces/IGateway.solOrderCreatedandsettleIndocs.SettleInevent comment formatting.contracts/Gateway.solfeestruct.tasks/accounts.tstasks/flatten.ts??defaulting, wrapped long replace call, explicit callback type).Breaking changes: None.
Alternatives considered:
References
N/A
Testing
Validation performed:
mainand re-applied cosmetic updates on top of the new onramp feature files.Environment:
Notes:
Test execution was not completed in this environment due to missing local Hardhat dependencies (
HHE22non-local installation error).This change adds test coverage for new/changed/fixed functionality
Checklist
mainBy submitting a PR, I agree to Paycrest's Contributor Code of Conduct and Contribution Guide.
Summary by CodeRabbit
Documentation
Chores