OpenZeppelin / OpenZeppelin/openzeppelin-contracts
Add internal view method for _baseURI in ERC1155URIStorage.sol
Nobody has claimed this yet.
- Dominant language
- Solidity
- Stars
- 27.2k
- Forks
- 12.4k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 33
Description
🧐 Motivation
Hi, My contract inherit from ERC1155URIStorage.
In _baseURI I store the ipfs access url: "https://ipfs.io/ipfs/" and then in _tokenURIs, all CID of my token.
But on top of that, all tokens need to access to an other ipfs resource, and, because I can't access to _baseURI, I have to store "https://ipfs.io/ipfs/" a new time?
📝 Details
A solution could be to add this view function add the end of the contract.
/*
@dev Get _baseURI
*/
function _getBaseURI() internal view returns (string memory) {
return _baseURI;
}
It can be useful for other use case, is not risky because it's only a view method ...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading ERC1155URIStorage.sol and locate the _baseURI storage and access points. Check the contract's existing tests or usage for URI behavior, then confirm that the requested internal view access is available without changing how token URIs are resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- blockchain
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100