OpenZeppelin / OpenZeppelin/openzeppelin-contracts
A method to get an image from an ERC20 contract.
Nobody has claimed this yet.
- Dominant language
- Solidity
- Stars
- 27.2k
- Forks
- 12.4k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 33
Description
🧐 Motivation
There are multiple benefits of getting an image directly from a smart contract of an ERC20 token.
-
Transparency and Decentralisation: By fetching an image from a smart contract, token creators can ensure that the image is stored on the blockchain and is accessible to anyone with access to the contract. This can help to increase Transparency and Decentralisation, which are key principles of blockchain technology. -
Security: Storing the image on the blockchain can also improve security, as it is more difficult for malicious actors to tamper with or modify the image. This can help to protect the integrity of the token and reduce the risk of fraud or hacking. -
Cost-effectiveness: Using a smart contract to store an image can be a cost-effective approach, as it eliminates the need for a centralised server or other infrastructure to store the image. This can help to reduce overhead costs for token creators and make it easier to launch a new token or project. -
Flexibility: Fetching images from smart contracts can be a flexible approach, as the image can be updated or changed at any time by the contract owner. This can allow token creators to adapt to changing market conditions or user feedback and make adjustments to their branding as needed. -
Improved Accessibility: Fetching images from smart contracts can improve accessibility for users who may have difficulty accessing traditional images or visual content. For example, users with visual impairments may be able to access alternative text descriptions of the image, which can help to make the token more inclusive and accessible. -
Ease of Implementation: Fetching images from smart contracts can be a relatively easy and straightforward process, particularly if standardised protocols are used. This can make it easier for token creators to integrate the image into their project and reduce the risk of errors or complications. -
Ease of Update: As the token's admin, if you need to update the image, you can simply update it in the smart contract and all third-party services that fetch the image will display the updated image in real-time. This can save time and money, as it eliminates the need to inform each third-party service separately and ensures that the image is updated consistently across all platforms.
📝 Details
- A method to set the SVG image in string format.
- A method to get the SVG image url in string format.
I took inspiration from generateNftSvgByTokenId method in On-chain-svg-nft-tickets
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 reviewing the requested ERC20 methods and the referenced generateNftSvgByTokenId method in On-chain-svg-nft-tickets, specifically ETHTickets.sol. Define the storage, update behavior, returned SVG URL format, and compatibility expectations before implementation; done should include tests for setting and retrieving the image.
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