简体   繁体   English

如何为 ERC20 代币添加徽标?

[英]How to add a logo to an ERC20 token?

I am new to blockchain.我是区块链新手。 I really couldn't understand how to add logo to my erc20 crypto token on polygon before listing it on any coin market.在任何硬币市场上上市之前,我真的不明白如何在多边形上的我的 erc20 加密令牌上添加徽标。

我想将自己的自定义图像添加到圆形部分

I want to add my own custom image to the circular portion.我想将自己的自定义图像添加到圆形部分。 How can I change this current logo to something new and If I transfer the token to some other account, my custom logo will be displayed?如何将此当前徽标更改为新徽标,如果我将令牌转移到其他帐户,将显示我的自定义徽标? Please help.请帮忙。

MetaMask implements the EIP-747 standard (currently unfinished in May 2022) and its wallet_watchAsset method to display custom token logo. MetaMask 实现了EIP-747标准(目前在 2022 年 5 月未完成)及其wallet_watchAsset方法来显示自定义令牌徽标。

Mind that this is not a centralized database of logos per token address, so each MetaMask instance can theoretically display a different logo for the same token.请注意,这不是每个令牌地址的集中式徽标数据库,因此每个 MetaMask 实例理论上可以为同一令牌显示不同的徽标。 And that users need to explicitly add the logo either manually or by confirming a MetaMask popup opened by a snippet from your web app.并且用户需要手动或通过确认由您的网络应用程序片段打开的 MetaMask 弹出窗口来显式添加徽标。

Code example from MetaMask docs : MetaMask 文档中的代码示例:

const wasAdded = await ethereum.request({
    method: 'wallet_watchAsset',
    params: {
        type: 'ERC20', // Initially only supports ERC20, but eventually more!
        options: {
            address: tokenAddress, // The address that the token is at.
            symbol: tokenSymbol, // A ticker symbol or shorthand, up to 5 chars.
            decimals: tokenDecimals, // The number of decimals in the token
            image: tokenImage, // A string url of the token logo
        },
    },
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM