Skip to content

docs: use SafeERC20 in ADR 003 staking examples - #102

Merged
thiras merged 1 commit into
mainfrom
fix/safeerc20-adr003
Apr 1, 2026
Merged

thiras merged 1 commit into
mainfrom
fix/safeerc20-adr003

Conversation

@thiras

@thiras thiras commented Apr 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace bare token.transfer / token.transferFrom with SafeERC20 wrappers (safeTransfer, safeTransferFrom) in the ADR 003 client staking snippet
  • Add using SafeERC20 for IERC20 declaration to the snippet
  • Aligns ADR 003 examples with ADR 010's SafeERC20 usage for non-returning ERC-20 tokens (e.g. USDT)

Part of #95

Test plan

  • Verified no bare .transfer() / .transferFrom() calls remain in any ADR
  • Review snippet consistency with ADR 010 SafeERC20 patterns

🤖 Generated with Claude Code

Replace bare token.transfer / token.transferFrom with SafeERC20
wrappers in the client staking snippet to handle non-returning
ERC-20 implementations (e.g. USDT), consistent with ADR 010.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings April 1, 2026 21:45
@thiras thiras changed the title docs: use SafeERC20 in ADR 003 staking examples (fixes #95) docs: use SafeERC20 in ADR 003 staking examples Apr 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates ADR 003’s staking example to use OpenZeppelin SafeERC20 wrappers so the documentation reflects best-practice ERC-20 handling (including tokens that don’t return bool on transfers, e.g. USDT), consistent with the rationale described in ADR 010.

Changes:

  • Replace token.transferFrom(...) / token.transfer(...) with token.safeTransferFrom(...) / token.safeTransfer(...) in the client staking snippet.
  • Add using SafeERC20 for IERC20; to enable the safe* extension methods in the snippet.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Solidity code snippets in the adr/003-payments.md file to use the SafeERC20 library for token transfers, replacing standard transfer and transferFrom calls with safeTransfer and safeTransferFrom. Feedback was provided regarding the placement of the using SafeERC20 for IERC20; directive, suggesting it be clarified as a contract-level directive for better documentation accuracy.

Comment thread adr/003-payments.md Resolved
@thiras
thiras merged commit fc86371 into main Apr 1, 2026
4 checks passed
@thiras
thiras deleted the fix/safeerc20-adr003 branch April 1, 2026 21:55
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.

2 participants