> For the complete documentation index, see [llms.txt](https://docs.chiliz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chiliz.com/th/phatthana/sung-khuen/omnichain-tokens.md).

# ใช้งาน Omnichain Tokens

คู่มือฉบับสมบูรณ์เกี่ยวกับมาตรฐาน LayerZero OFT และ ONFT บน Chiliz Chain: กลไก lock-and-mint, รูปแบบ OFT Adapter และการ bridge ระหว่าง EVM chains และ Solana

## เกี่ยวกับ LayerZero และมาตรฐาน omnichain token

[LayerZero](https://layerzero.network/) คือโปรโตคอลส่งข้อความแบบ omnichain

ต่างจาก bridge แบบดั้งเดิมที่ล็อกสินทรัพย์บน chain หนึ่งและสร้างสำเนาที่ wrapped ขึ้นบนอีก chain หนึ่ง LayerZero ช่วยให้ smart contract บน chain ต่างๆ สามารถ "พูดคุย" กันได้โดยตรง\
ซึ่งทำได้ผ่านมาตรฐาน Omnichain Fungible Token (OFT) สำหรับ token ทั่วไป และมาตรฐาน Omnichain Non-Fungible Token (ONFT) สำหรับ NFT

เรียนรู้เพิ่มเติมเกี่ยวกับมาตรฐาน OFT และ ONFT ได้ที่นี่:

{% embed url="<https://docs.layerzero.network/v2/concepts/applications/oft-standard>" %}

ในทางปฏิบัติ OFT ของ LayerZero ช่วยให้ project token (เช่น $PSG หรือ $CITY) สามารถดำรงอยู่บน Chiliz Chain ได้โดยตรง พร้อมกับย้ายไปยัง blockchain อื่นๆ และระบบนิเวศของพวกมันได้อย่างราบรื่น

LayerZero รองรับสินทรัพย์มากกว่า 700 รายการใน blockchain network กว่า 170 แห่ง ด้วย smart contract OFT/ONFT จำนวนเท่ากัน:

{% embed url="<https://docs.layerzero.network/v2/deployments/oft-ecosystem-stargate-assets?stages=mainnet>" %}

ในบรรดา network เหล่านั้น ได้แก่ chain ที่เข้ากันได้กับ EVM อย่าง Chiliz Chain เช่น Ethereum รวมถึง Base, Arbitrum, Polygon, BNB Chain และอื่นๆ\
แต่ LayerZero ยังรองรับ chain ที่ไม่ใช่ EVM ด้วย เช่น Solana, Aptos, Sei, TON และอื่นๆ

## ทำไมต้องทำให้ project token เป็น omnichain?

การ bridge project token ผ่าน LayerZero จะแปลงให้เป็นสินทรัพย์แบบ omnichain ที่สามารถอยู่และใช้งานได้ทุกที่ ซึ่งนำมาซึ่งการทำงานร่วมกันได้ และดังนั้นจึงได้รับประโยชน์ดังนี้:

* ผู้ถือ project token สามารถใช้ token ของตนในที่ที่มีประโยชน์มากที่สุด
* นักพัฒนา dApp บน Chiliz Chain สามารถทำให้ dApp ของตนรับฝากเงินจากผู้ใช้บน chain อื่นๆ ได้
* สโมสรกีฬาสามารถขยายการเข้าถึง Fan Tokens ของตน เปิดโอกาสให้แฟนๆ นอกฐานผู้ใช้ Chiliz Chain เข้าถึงได้

แนวคิดหลักยังคงเหมือนเดิม: การทำให้ project token ทำงานข้าม chain ได้ จะเพิ่มประโยชน์ของ token อย่างกว้างขวาง

## วิธีการทำงาน

{% hint style="info" %}
คำอธิบายนี้อ้างอิงจาก blockchain ที่ใช้ EVM เช่น Chiliz Chain, Base และ Ethereum\
LayerZero ยังรองรับ blockchain ที่ไม่ใช่ EVM ด้วย เช่น Solana
{% endhint %}

ในการสร้าง omnichain project token บน Chiliz Chain จำเป็นต้องนำ smart contract `OFT.sol` มาใช้งาน ซึ่ง contract นี้ขยายมาจาก contract `ERC20.sol` มาตรฐาน

{% embed url="<https://github.com/LayerZero-Labs/LayerZero-v2/blob/main/packages/layerzero-v2/evm/oapp/contracts/oft/OFT.sol>" %}

เนื่องจาก project token ส่วนใหญ่มีอยู่ในรูปแบบ token ERC-20 มาตรฐาน เราจึงไม่สามารถแทนที่ contract ของพวกมันด้วย contract `OFT.sol` ได้โดยตรง

เพื่อทำให้เป็น omnichain โดยไม่ต้องออก token ใหม่ เราจำเป็นต้องใช้รูปแบบ OFT Adapter:

{% embed url="<https://docs.layerzero.network/v2/developers/evm/oft/quickstart#oft-adapter>" %}

... ซึ่งใช้ smart contract `OFTAdapter.sol`:

{% embed url="<https://github.com/LayerZero-Labs/LayerZero-v2/blob/main/packages/layerzero-v2/evm/oapp/contracts/oft/OFTAdapter.sol>" %}

วิธีนี้ช่วยให้ขยายความสามารถของ token ได้โดยไม่ต้องเปลี่ยนแปลง: OFT Adapter ทำหน้าที่เป็นตัวกลางระหว่าง token ที่มีอยู่กับ network ของ LayerZero

ผ่าน adapter นั้น token สามารถสื่อสารกับ smart contract `OFT.sol` ที่ปรับใช้บน chain ปลายทางได้\
เมื่อ bridge token, smart contract OFT Adapter บน Chiliz Chain จะ "ล็อก" จำนวน token หนึ่ง และแจ้งให้ smart contract OFT บน chain ปลายทาง "สร้าง" token จำนวนเท่ากันสำหรับ chain นั้น\
เมื่อผู้ถือต้องการนำ token กลับมาที่ Chiliz Chain, smart contract OFT บน chain ปลายทางจะเผาทำลาย token และ smart contract OFT Adapter บน Chiliz Chain จะปลดล็อกและคืน token ต้นฉบับ

กลไก "Lock-and-Mint" นี้ช่วยให้อุปทานหมุนเวียนทั้งหมดคงที่ตลอดทุก chain พร้อมทั้งรักษาความไม่เปลี่ยนแปลงและประวัติของ smart contract token ต้นฉบับบน Chiliz Chain

## คู่มือ EVM ถึง EVM

{% content-ref url="/pages/RBEakzafHn7SWdR181nG" %}
[Bridge จาก Base ไป Chiliz Chain](/th/phatthana/sung-khuen/omnichain-tokens/base-to-chiliz.md)
{% endcontent-ref %}

{% content-ref url="/pages/5p3rBMCe8TzOoTLUtFE0" %}
[Bridge จาก Chiliz Chain ไป Base](/th/phatthana/sung-khuen/omnichain-tokens/chiliz-to-base.md)
{% endcontent-ref %}

## คู่มือ non-EVM ถึง EVM

{% content-ref url="/pages/3s8pHC7UH1eIq5Wkeh13" %}
[Bridge จาก Solana ไป Chiliz Chain](/th/phatthana/sung-khuen/omnichain-tokens/solana-to-chiliz.md)
{% endcontent-ref %}

## คู่มือ EVM ถึง non-EVM

{% content-ref url="/pages/FigJljxFbodcQEooep8j" %}
[Bridge จาก Chiliz Chain ไป Solana](/th/phatthana/sung-khuen/omnichain-tokens/chiliz-to-solana.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chiliz.com/th/phatthana/sung-khuen/omnichain-tokens.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
