Neon EVM中NEON代币余额存储和维护 (NEON Token Balance Storage and Maintenance in Neon EVM)

NEON is an SPL token minted on the Solana blockchain. It was created to serve as the native token for Neon EVM, similar to ETH’s role on the Ethereum blockchain. NEON holders will use the token to pay for Neon EVM gas fees and participate in Neon governance.

NEON 是在 Solana 区块链上铸造的 SPL 代币。它之所以被创造出来,就是为了作为 Neon EVM 的原生代币,类似于 ETH 在以太坊区块链上的角色。 NEON 持有者将使用该代币支付 Neon EVM gas 费用并参与 Neon 治理。

In this article, we dive into how NEON token balances are stored and maintained inside an EVM environment despite being an SPL token.

在本文中,我们将深入探讨 NEON 代币余额如何在 EVM 环境中存储和维护,尽管它是 SPL 代币。

将 NEON 从 Solana 迁移到 Neon EVM (Moving NEON into Neon EVM from Solana)

NEON is an SPL token and can’t be stored normally in EVM environments. As such, when NEON tokens are transferred from Solana into Neon EVM, they’re all sent to the Neon Pool account rather than individual Neon EVM accounts. The Neon Pool account is a Solana account that contains all NEON tokens held in Neon EVM. To track how much NEON users own, all Neon EVM accounts contain data that reference the amount of tokens users are entitled to from the Neon Pool.

NEON 是 SPL 代币,不能在 EVM 环境中正常存储。因此,当 NEON 代币从 Solana 转移到 Neon EVM 时,它们都被发送到 Neon Pool 帐户而不是单个 Neon EVM 帐户。 Neon Pool 账户是一个 Solana 账户,其中包含 Neon EVM 中持有的所有 NEON 代币。为了跟踪 NEON 用户拥有的数量,所有 Neon EVM 帐户都包含用户有权从 Neon 池中获得的代币数量的数据。

When NEON is transferred between accounts, no actual tokens are moved. The data in each Neon EVM account involved with the transaction is aptly updated to reflect the new balances.

当 NEON 在账户之间转移时,不会移动实际的代币。与交易相关的每个 Neon EVM 账户中的数据都会适当更新来反映新的余额。

The implementation of NEON storage and accounting described above allows the EVM to closely emulate Ethereum behavior while using an SPL token as its foundational payment and governance asset.

上述 NEON 存储和记账的实现,允许 EVM 在使用 SPL 代币,作为其基础支付和治理资产的同时,密切模拟以太坊行为。

将 NEON 从 Neon EVM 转移到 Solana (Moving NEON from Neon EVM into Solana)

For transfers of NEON back into the Solana environment, tokens from the Neon Pool are moved to the destination Solana account. The NEON balance data in the source Neon EVM account is then updated once the transaction is confirmed. In this scenario, NEON token balances are shifted from one Solana account to another.

为了将 NEON 转移回 Solana 环境,来自 Neon Pool 的代币将被转移到目标 Solana 账户。一旦交易被确认,源 Neon EVM 账户中的 NEON 余额数据就会更新。在这种情况下,NEON 代币余额会从一个 Solana 账户转移到另一个账户。

处理代币精度的差异 (Handling Variances in Token Precision)

Token precision is the number of digits after the decimal that can be tracked by a blockchain. Ethereum’s token precision is 18, meaning the blockchain can recognize 10^-18 ETH. Neon EVM, being an EVM environment, naturally also has a token precision of 18. On the other hand, Solana’s default token precision is 9. Due to the variance in token precision, Neon EVM is able to track much smaller increments of a token than Solana. Therefore, in order to maintain accurate NEON token balances, users can’t move less than 10^-9 NEON tokens between Solana and Neon EVM. Additionally, all NEON tokens moved between Solana and Neon EVM must be divisible by 10^-9 or more.

代币精度是区块链可以跟踪的小数点后的位数。以太坊的代币精度为 18,意味着区块链可以识别 10^-18 个 ETH。 Neon EVM 作为 EVM 环境,自然也有 18 的代币精度。另一方面,Solana 的默认代币精度是 9。由于代币精度的差异,Neon EVM 能够跟踪比代币更小的增量Solana。因此,为了保持准确的 NEON 代币余额,用户不能在 Solana 和 Neon EVM 之间移动少于 10^-9 个 NEON 代币。此外,在 Solana 和 Neon EVM 之间移动的所有 NEON 代币必须能被 10^-9 或更多整除。

赞赏