-
Notifications
You must be signed in to change notification settings - Fork 21
Replace erc20/ Prefix to erc20: in Native ERC20 Coin Denoms #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It's recommended to abandon legacy burdens and move forward with the new architecture. |
I don't think that changing token denoms is generally a safe practice, as it could break things with IBC and modules on other chains. The chain can't know for certain where the token has been transferred to, nor would we be able to migrate external chains if we wanted to. There are users that have the The only place I really see a check being done is ValidateErc20Denom, which is only actually ever used in a test. So unless I'm missing something, removing the prefix from tokens wouldn't actually break anyone existing. We know that the IBC team has an issue open to support the Seems fine to me if we just remove the prefix for future denoms and keep the current ones as is. |
Apps that build modules that use the legacy token wouldn't even need to handle the existing denoms with the prefix and new ones without the prefix separately since they're stored as a TokenPair in the module anyways. The only time you'd need to handle separately is if you're doing some kind of denom validation. As mentioned above, it looks like we don't. |
TODO: Add something in a "migration guide" type readme where we mention that old denoms with |
@vladjdk We can keep existing denoms as-is, and apply the change only to newly created ones going forward. I also double-checked whether this change could result in two token pairs being registered for the same contract. Thankfully, IsERC20Registered validates by contract address rather than denom, so we’re safe there — if the check had been done by denom, it might have led to duplicates. So from what I can see, the prefix removal looks safe, and I don’t see any obvious risks at this point. Happy to move forward with it unless there’s anything else we should consider. |
@Eric-Warehime So the message could be something like: “ |
@vladjdk I just realized that we can’t directly use the contract address as a denom when registering an ERC20 as a native token. The Cosmos bank module enforces the regex How about keeping What do you think? |
Since we don't really have a requirement for keeping the denom equivalent to the contract address, I say we go with |
@vladjdk Sounds good to me — I’ll proceed with replacing the current |
Background
IBC v2 does not allow
/
in the base denomination.IBC version 2 introduces a restriction that disallows slashes (
/
) in base denominations. As a r esult, any denom containing/
cannot be transferred using the IBC v2 router.Native ERC20 coins currently use the
erc20/
prefix, making them incompatible with IBC v2.What is a native ERC20 coin?
A native ERC20 coin is a Cosmos bank coin that represents an existing ERC20 token contract. It is created when a governance proposal registers a token pair between the ERC20 contract and a new bank denom (which starts with
erc20/
).This regsitration sets the contract owner to OWNER_EXTERNAL, since the ERC20 contract was already deployed by an EoA or CA(not the module itself).
Why do we pair an existing ERC20 with a bank denom?
Because IBC works only with coins stored in the Cosmos bank module, not EVM state. So, in order to send ERC20 tokens (stored in EVM) from a Cosmos EVM-based chain to another chain via IBC, we must first convert them a bank-native coin.
When is the
erc20/
prefix added?resulting in a denom like
erc20/0x…
What is an ERC20 token with
OWNER_MODULE
?This represents the “Single Token Representation V2” model. In this case, when a native coin from an external chain is received through IBC, the chain automatically:
This allows the coin to behave like a native bank coin in the EVM envrionment without requiring manual wrapping/unwrapping.
Discussion Points
/erc20
prefixcosmos/evm
orevmos/os
, anderc20/
prefix) in its state.erc20/
tokens via IBC v2.Internal Discussion & Additional Considerations
Recently, two main opinions emerged within our team:
Opinion 1
Even if IBC v1 deprecation seems unlikely or very far off, if/when it actually happens, all tokens using the
erc20/…
prefix (potentially scattered across multiple chains) would need to coordinate a simultaneous upgrade. This could create a huge migration task for every chain involved. Therefore, removing the prefix now (even if some chains already use it) might be better in the long run, avoiding future technical debt.Opinion 2
It might be best to gather more information before deciding:
erc20/0x...
prefixed coins in production?If usage is practically nonexistent (or no real user scenario), removing the prefix is simple. If there are many chains actively using it, perhaps continuing to rely on IBC v1 is acceptable, at least for now. The only downside is not being able to interoperate with IBC v2-only chains.
The text was updated successfully, but these errors were encountered: