-
Notifications
You must be signed in to change notification settings - Fork 523
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
Add ERC: Crosschain Token Interface #692
base: master
Are you sure you want to change the base?
Add ERC: Crosschain Token Interface #692
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggested amendments.
See #692 (comment) |
Yes, we could make it match with xERC20. The only difference between the two lies in function naming. In our proposal, we use distinct function names— We are open to collaborating on unifying the naming conventions, whether that involves adjusting names in our proposal or in xERC20. |
Thanks for clarifying @0xParticle. I do think it would be in the spirit of the ERC process to mitigate fragmentation by reusing the xERC20 function interface (subset). This seems much more natural than encouraging existing tokens to upgrade/migrate to this new interface. I understand that you think the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Xxx
Definitely understand the spirit of reusing where possible, one concern in reusing mint/burn is with generating a false sense of interoperability for tokens that are already deployed and have no way to deploying to the same address on other chains which I imagine will be important to mitigate the issue that authorized bridges will need to know what address does each token have in each chain - which I don't believe the xERC20 draft EIP has a formal requirement for currently. |
Thank you for your feedback! This has been the main concern so far, so I'll elaborate on why we think having separate functions makes a lot of sense. Local minting and burning are fundamentally different from cross-chain minting and burning.
Therefore, having different checks, access controls, and logic for cross-chain actions is reasonable. The mint/burn limits that xERC20 introduces are a great example. Merging local and cross-chain minting/burning into the same functions can lead to complex implementations that intertwine different operational logic. By splitting into two, we separate concerns, making the codebase cleaner and more maintainable. This separation of concerns is particularly relevant for
A similar reasoning applies to having dedicated cross-chain-specific events. The separation significantly facilitates the work of indexers, analytics tools, and auditors. It allows for straightforward tracking of cross-chain activities, detecting anomalies, and monitoring bridge operations. If cross-chain and local events are indistinguishable, off-chain agents must implement complex logic to differentiate them, increasing the potential for errors and inefficiencies. The analogy between distinguishing EOAs/contracts and local/cross-chain operations isn't directly applicable. As reflected in the protocol's roadmap, the Ethereum community is working towards account abstraction to unify EOAs and contract accounts. However, there's no equivalent movement to unify local and cross-chain token operations. Cross-chain actions inherently involve additional complexities and external dependencies that justify distinct handling in token contracts. Finally, the standard is still compatible with xERC20 via custom adapters, even with a different naming. We will work to improve this compatibility, as we think xERC20 is a great standard and want to support it. As a matter of fact, my folks at Wonderland are coauthors to the xERC20 standard. |
This looks very much like the Pantos token contract for native cross-chain tokens. Just the naming of the functions is different, yet concept is the same: |
Regarding compatibility with xERC20 (ERC-7802), I wrote this document: |
ERCS/erc-7802.md
Outdated
event CrosschainMint(address indexed _to, uint256 _amount, address indexed _sender); | ||
``` | ||
|
||
Note: implementations might consider additionally emitting `Transfer(address(0), _to, _amount)` to be compliant with [ERC-5679](./eip-5679.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly suggest making the Transfer events mandatory.
ERC-20 is more relevant than ERC-5679 IMO, and in the former it's already specified as SHOULD (i.e., a strong recommendation):
A token contract which creates new tokens SHOULD trigger a Transfer event with the _from address set to 0x0 when tokens are created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good catch. Just pushed to modify this invariant.
Gentle reminder to keep technical discussion in the Ethereum Magicians thread. It's easy to lose context after the pull request is merged. |
ERCS/erc-7802.md
Outdated
--- | ||
eip: 7802 | ||
title: Crosschain Token Interface | ||
description: Minimal token interface for cross-chain transfers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minimal
Too many standards claim to be minimal. I'd recommend removing this, and using your description to further elaborate on the ideas introduced in your title.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified this section, let me know your thoughts now
ERCS/erc-7802.md
Outdated
|
||
## Abstract | ||
|
||
This standard introduces a minimal interface for tokens to communicate cross-chain. It allows bridges with mint and burn rights to send and relay token transfers with a standardized API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not bad, but I'd like to see a bit more technical meat here. Could you sketch out how your proposal operates, in addition to the description you already have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more technical details.
|
||
**`CrosschainMint`** | ||
|
||
MUST trigger when `crosschainMint` is successfully called. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This leaves a lot unspecified (which is fine if it's intentional.) For example, should other non-standard functions that also effectively perform a crosschain mint also trigger this event, or is it specifically tied to this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is intentionally unspecified. The CrosschainMint
event MUST be triggered when the crosschainMint
function is successfully called. However, implementers are not restricted from emitting this event when using other non-standard functions that effectively perform a crosschain mint.
If the implementation adheres to this standard, the full interface—including crosschainMint
and crosschainBurn
—will already be available, so it is expected that these functions are used for crosschain minting and burning. That said, the event is not mandated for every action that triggers a crosschain operation, as this standard focuses specifically on the standardized interface.
As discussed in the Motivation section, a minimal, flexible cross-chain standard interface is necessary. The problem becomes larger as more tokens are deployed without a standardized format. | ||
|
||
- Upgradable tokens can be upgraded to implement the new interface. | ||
- Non-upgradable tokens cannot implement the interface on the token itself. They can still migrate to a standard-compliant version using a lockbox mechanism, as proposed by xERC-20. The idea is to lock non-mintable tokens and mint the same amount of interface-compliant tokens. The bridge contract can act as a lockbox on the native chain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does xERC-20 have an ERC? If so, you should link it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has an open PR to the ERC repo with assigned number 7281, but it has not been merged. If I mention the ERC-7281 in this ERC, the EIP validator asks for an internal link, which I can't reference at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defi-wonderland:erc/crosschain-token-interface
Co-authored-by: Sam Wilson <[email protected]>
Co-authored-by: Sam Wilson <[email protected]>
…d fix license in reference implementation
The commit 5d26ebb (as a parent of d3b7d38) contains errors. |
…to crosschainMint
This ERC introduces a minimal interface for tokens to communicate cross-chain. It allows bridges with mint and burn rights to send and relay token transfers with a standardized API.