OpenZeppelin / OpenZeppelin/openzeppelin-contracts

Feature request: modern implementation of "SafeERC20Namer" library

Open
#4,277 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Solidity
Stars
27.2k
Forks
12.4k
Avg merge
2d 19h
Merged PRs (30d)
33

Description

It would be nice to have a modern implementation of Uniswap's SafeERC20Number library:

https://github.com/Uniswap/solidity-lib/blob/c01640b0f0f1d8a85cba8de378cc48469fcfd9a6/contracts/libraries/SafeERC20Namer.sol

Ideally, the implementation would provide an additional tokenDecimals helper for safely retrieving the ERC-20 decimals (just like Yield's version does).

I imagine that this functionality could be incorporated in your existing SafeERC20 library?

The use case for this is anything that needs a reliable way of retrieving ERC-20 token metadata on-chain, e.g. NFT SVGs:

https://github.com/Uniswap/v3-periphery/blob/6cce88e63e176af1ddb6cc56e029110289622317/contracts/NonfungibleTokenPositionDescriptor.sol#L70-L92

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing SafeERC20 library and compare the linked Uniswap SafeERC20Namer.sol and Yield implementation. Determine how the requested token name, symbol, and tokenDecimals helpers should fit the library's current API and compatibility expectations. Done means the proposed metadata behavior is specified and covered by the repository's relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity
Domain
blockchain
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.