Repository navigation
docs: use SafeERC20 in ADR 003 staking examples - #102
Conversation
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]>
There was a problem hiding this comment.
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(...)withtoken.safeTransferFrom(...)/token.safeTransfer(...)in the client staking snippet. - Add
using SafeERC20 for IERC20;to enable thesafe*extension methods in the snippet.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
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.
Summary
token.transfer/token.transferFromwithSafeERC20wrappers (safeTransfer,safeTransferFrom) in the ADR 003 client staking snippetusing SafeERC20 for IERC20declaration to the snippetPart of #95
Test plan
.transfer()/.transferFrom()calls remain in any ADR🤖 Generated with Claude Code