Sui.

Bài viết

Chia sẻ kiến thức của bạn.

tomek.
Jan 29, 2025
Hỏi đáp Chuyên Gia

How to update coin logo on Sui smart contract?

I'm trying to update the coin logo on a deployed smart contract on SuiCoins.com, but I've hit a roadblock because the contract is immutable. Are there any possible workarounds or methods like using proxy contracts or implementation contracts to change the logo so it reflects on platforms like suiscan or suivision?

  • Sui
3
3
Chia sẻ
Bình luận
.

Câu trả lời

3
Michelle .
Jan 30 2025, 08:11

Bạn không thể cập nhật trực tiếp siêu dữ liệu cho hợp đồng thông minh bất biến. Tuy nhiên, nếu hợp đồng thông minh của bạn sử dụng mô-đun tiền xu và bạn đã được cung cấp TreasuryCap, bạn có thể sử dụng update_icon_urlphương pháp để cập nhật URL của biểu tượng đồng tiền trong siêu dữ liệu. Điều này sẽ không hoạt động nếu bạn đã tạo mã thông báo cung cấp cố định.

3
Câu trả lời hay nhất
Bình luận
.
andreweth..
Jan 30 2025, 12:07

Nếu việc cập nhật icon_urltrong CoinMetadata không phản ánh ngay lập tức trên các nhà thám hiểm như suiscan, bạn có thể muốn kiểm tra xem có sự chậm trễ hay bạn có cần kích hoạt làm mới trên các nền tảng này không. Đôi khi bản cập nhật phản ánh trong ví đa chữ ký nhưng mất thời gian để xuất hiện trên trình khám phá.

2
Bình luận
.
Vhekee.
Aug 27 2025, 00:28

Updating a coin logo on a deployed Sui smart contract can be challenging due to the contract's immutability. However, there are potential workarounds to achieve this.

Possible Solutions

  • Update Coin Metadata: If the CoinMetadata object was not frozen upon creation, you can use functions like update_icon_url to update the logo URL. This requires having the necessary permissions and access to the TreasuryCap object associated with your coin.
  • Create a New Coin: If the metadata is frozen, one option is to create a new coin with the updated logo and migrate users to the new coin. This involves creating a new smart contract with the updated logo and functionality to transfer existing tokens to the new coin.
  • Use a Proxy Contract: Although not directly applicable to updating metadata, proxy contracts can be used to implement upgradeable logic in your smart contract. This might involve creating a proxy contract that points to the original contract and updates the logo URL accordingly.

Steps to Update Coin Metadata

  1. Verify CoinMetadata Status: Check if the CoinMetadata object is frozen or not. If it's not frozen, you can proceed with updating the logo URL.
  2. Use update_icon_url Function: Call the update_icon_url function with the new logo URL to update the coin metadata.
  3. Verify the Update: After updating the logo URL, verify that the change is reflected on platforms like SuiScan or SuiVision.

Additional Resources

  • Sui Documentation: Refer to the official Sui documentation for detailed information on updating coin metadata and working with smart contracts.
  • Sui Developer Community: Join the Sui developer community to ask questions and get help from experienced developers ¹.

Keep in mind that the specific steps and feasibility of updating a coin logo may vary depending on your smart contract's implementation and the Sui network's policies.

1
Bình luận
.

Bạn có biết câu trả lời không?

Hãy đăng nhập và chia sẻ nó.