SEP-41: Add a token contract interface proposal#1402
Conversation
|
So my questions are all like poking holes in your amazing proposal. Thanks for taking the first stab which lets us discuss and iterate! CIPs:
Sections:
The Token Interface:
|
I think the audience of CIPs and SEPs are broadly different. I think folks in the CIP audience will find it easier to engage in a smaller focused place to define and share common contract interfaces. I think the evolution story of CIPs and SEPs will be different too. I think once CIPs are adopted they'll be hard to change. Probably new features will be a new CIP. SEPs on the other hand do typically evolve, sometimes in significant ways. I think there's some advantage to disconnecting on-chain vs off-chain interoperability. For example, define a contract interface in a CIP, then define a coordinated off-chain use of that CIP in a SEP. 🤔 But you raise a great point about CIPs living on chain naturally by their original implementer deploying a contract that implements it. For contracts that have an initial implementation that could work well. The token interface is unique in that it doesn't really have an initial implementation in wasm form. Tooling gets its interface from the soroban-sdk.
👍🏻 I'll remove the abstract, it's redundant. Removed in 537cbc4.
It's not very obvious, but every markdown document on GitHub has a table of contents on the right side you can expand.
The document has versioning at the top and in the changelog.
What do you see being included in that section?
At the top, the preamble has a discussion link. It's currently TBD, but that's where it'll go.
I don't know. CAPs and SEPs do not have it. Can you take that question to the legal team? cc @tomerweller
👍🏻 That's a great point. While the contract interface has done a decent job of capturing the format of shared data, it hasn't done a great job of capturing the format of events. In fact, there's no events captured in the contract interface. If the contract interface was only consumed by other contracts that limitation would make sense since contracts don't consume events. But other tooling is code generated off the interface and if the events were included in the interface we could generate the types there too. I've opened an issue to track that:
|
I think the authors for both are different but the audience/consumers for both are ecosystem developers, no? We have an opportunity to somewhat mold how CIPs might evolve: ERC223 was a significant improvement on ERC20 but it was never widely adopted due to the network effects of ERC20. If there had been a way to upgrade ERC20, the benefits of ERC223 might have percolated deeper. The notable exception is ERC72, which addresses a completely different use case. All that to say that the evolutionary arc of a SEP might be preferable for CIPs.
I think CIPs would be a general way to formalize functionality that the ecosystem has achieved previously by hacking. It could also be functionality that has existed on other ecosystems and should be brought to Soroban. By formalizing, the ecosystem is converging on how the functionality should live on Soroban. In both cases, some implementation came before the actual CIP. If there are examples that contradict the above, just let me know.
Let's revisit after building consensus on the evolutionary story of CIPs.
Got it. So ERC-20 has some pitfalls that were fixed in later EIPs like 223 and others. We can add those benefits here but we can also add those later in favor of shipping this asap. |
|
Surfacing enhancements to ERC-20 that we might want to add to the Soroban Token Standard.
|
I just want to make it clear that we iterated on the token standard quite a lot and it is developed with Soroban features in mind (and some solutions to ERC-20 problems).
Not sure I understand this, how can one tell whether an address is valid or not? From reading the EIP, it doesn't seem to me like it's about invalid addresses, it seems more like one of the workarounds for atomic transfers, which we already support via Soroban auth framework.
Events are already in the standard. Hooks are not supported in Soroban, at least not in v1. Not sure what's the 'custom behaviors' feature about.
Given that SAC doesn't support logo, this seems like a possible standard extension. I think we'd like this standard to be compatible with SAC. Additional features like this one can be added as separate standards/extensions. On a side note, I'm not sure what the EIP does for logos. |
To add to this, the proposal in this PR is really just capturing existing interface rather than re-validating it. I should probably change it's status to "Final" in the doc. But also, if we are going to make changes before this is final, now is the time? |
Stellar supports logo finding today via SEP-1. Maybe that's not how we should do it moving forward, but that's how it works today. Probably no harm in continuing to do it, but we might also need to think about how to incorporate contract tokens into SEP-1. |
Yes, we do support it in off-chain way, which is why SAC can't support it for now. My point here is not that we shouldn't come up with some standard for the custom tokens, it's rather that we should have the 'base' interface compatible with SAC and then add extensions to it that aren't compatible with SAC (yet). |
A large problem in the EVM ecosystem is assets being sent to the wrong address, such that they are lost irreversibly. I don't want to have this problem on Soroban. ERC-223 attempts to mitigate it. What is our solution to the problem?
The interface (CIP-1) may have started from the SAC but do we want it to strictly adhere to SAC? Why? The goal is to define an interface that'll be used by future tokens. So, at the very minimum, the interface should specify functionality that'll be useful to majority of the Soroban ecosystem. If majority of the ecosystem needs to add extensions to offer basic functionality (for example, logos), then what is point of the base interface? |
That's great btw. Link me to the notes? Would love to understand the rationale. |
Stellar has historically had the reverse problem. In the Stellar payment operations that exist today, recipient accounts must exist, and must have been setup with the asset enabled (it's called a trust line). This has introduced inefficiencies into interop flows that were difficult to overcome, to the point that we added claimable balances so that folks could send to addresses that both don't exist yet and don't have assets enabled yet. With Soroban we've tried to address this by allowing sends to accounts/addresses that don't exist yet. |
I must admit that I don't understand how does EIP-223 solve this problem, or how this problem can be solved in general. What I can infer from it, is that they're trying to solve a problem of 'transfer, then do something' pattern, which is solved in Soroban in general via call tree auth. But this has nothing to do with 'wrong' addresses - nothing prevents your from sending your token to a valid address B instead of a valid address A, neither in Soroban, nor in ETH. Stellar does have a few more safeguards compared to ETH, e.g. strkeys are check-summed so at least the chance of sending to a completely incorrect address is low.
Because SAC is likely going to be the most prevalent token implementation due to a huge number of benefits (cheap cost, verified implementation, classic interop, classic DEX/LP access etc.). If you develop a new token, it likely needs to be SAC compatible (or vice versa - if we think that some functionality has to belong to tokens, it should be in SAC).
FWIW I don't see the need for logo functionality to be present in the interface (as interface is meant for cross-contract interaction and I doubt contracts ever need to fetch it directly) and I'm also not entirely sold on the idea of storing the logs on-chain in the first place. Off-chain mechanism works fine for classic. Similar mechanism can be developed for custom tokens - but it doesn't have to be a part of the common interface (arguably, the same can be said about the
Rationale for what? We've had several design discussions and iterations both on token interface and on auth in general. I don't think there is a single place to look though. CAP-46-06 details some design choices, but I don't think it captures everything. |
|
In general I think this is a great idea however the naming is slightly confusing to me. In Ethereum EIPs are more like CAPs as they are proposals to improve Ethereum itself where ERC is more like what you're proposing here. I think having three different and similar yet not in the way you're thinking, will further confuse the ecosystem. I wonder if SRC (Soroban Request for Comment) I also wonder if we can just rework SEPs to better support contract interface standards. Personally I think I'd be more keen to revamp the SEP system vs creating something new. |
|
@leighmcculloch @dmkozh given that at least 65 tokens are already using the SAC and given the info in CAP-46-6, it makes sense to ship the token interface asap based on SAC; and add other capabilities to future proposals or extensions. I'll withdraw my last 3 comments from this issue and save them for later discussion. |
|
The interface looks good to me. I still have my gripes with Some general comments: EventsI'd highly prefer if we could separate For the token contract this is more obvious, but for more complicated scenarios events will not match up 1 to 1 with functions so the event definitions will be hard to follow. CIPsGiven I want a separate Going to suggest SIP (Stellar Interface Proposal) or (Soroban Interface Proposal). I also don't mind @tyvdh's SRC. Lastly, it was fairly awkward writing https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0040.md as a SEP, so I think some direction should be taken as more Interfaces are bound to get proposed. Ethereum ERC-20 FixesI'm mostly in agreement with @dmkozh here. The majority of the proposed fixes to ERC-20 don't really make much sense in Soroban. (Also no-matter what is proposed none if these have gotten any serious traction AFAIK) ERC-223: XLM (and Stellar Classic) doesn't require or expect a https://eips.ethereum.org/EIPS/eip-2612: I could see some value in adding permits. But, I don't know why a contract wouldn't use the auth-next abilities instead for user interactions. cc: @leighmcculloch |
We have an open issue to make events a first-class Rust type, such that they would be defined like contract types. If that happens, they'd be discussed clearly in their own portion of the interface. I think this would address your concern. The related issue is: |
This would be great! Even without this, I still think an |
|
@MonsieurNicolas made a point offline to me that we could have contract interfaces be a template within SEPs, and there's no reason we can't have multiple templates for proposals within SEPs. After thinking about that, I see some benefits in going that route. For proposals that blur the lines between different types, it's easier if everything is a SEP with categories/labels, since a SEP might fit in multiple categories. I'm inclined to rename CIP-1 to be a SEP-N like SEP-40, and then add an optional categories meta field to SEPs, and add the Category "Contract Interface" to SEP-N and SEP-40. Thoughts @MonsieurNicolas @tyvdh @mootz12 @namankumar ? |
A category makes sense to me. Alternatively we need to Prefix Soroban SEPS appropriately ("Soroban Token Interface"). Regardless, the title is too generic right now. Also ERC-20 is called "Token Standard", any thoughts on "Standard" vs. "Interface"? |
I think either works. Interfaces become standards when they're successful. SEP-40 referred to itself as the Oracle Consumer Interface, so I've followed suite for SEP-41 at the moment. Should we prefix the title with |
|
@tomerweller I added a Soroban prefix to the title. |
|
I'll keep the document in Draft status until the pubnet launch, then we can shift it to Final then. |
|
This is looking great guys.
I agree it would keep it less cluttered. I just made a first draft of a NFT collection interface to be similar to ERC-1155. Based on a not yet finished implementation. #1406 Will love your feedback there. I haven't defined the events here yet but it does seem like it would make sense to have them since knowing what events are emitted can be helpful for dapp and contract developers alike. |
| /// # Arguments | ||
| /// | ||
| /// - `id` - The address for which a spendable balance is being queried. | ||
| fn spendable_balance(env: Env, id: Address) -> i128; |
There was a problem hiding this comment.
Does this interface need a spendable_balance (I think this was discussed recently but don't remember what came out of that).
There was a problem hiding this comment.
The discussion and resolution is here:
The resolution was we could go both ways so leave it. But, I've lost count how many times this has come up, and every time the opinion is "it doesn't belong."
I think we could remove it with little impact.
cc @tomerweller
Co-authored-by: Siddharth Suresh <siddharth@stellar.org>
kalepail
left a comment
There was a problem hiding this comment.
This is great! Excited to see more of these. I do wonder if this should have a different name than the "Soroban Token Interface" though. There will likely be many "Soroban Token Interfaces" so specifying this as a fungible or standard or basic or base or some such nomenclature allows for more diversity later on.
If there becomes many token interfaces I don't think naming it the "Fungible Token Interface" will do much to distinguish because of many there's likely many fungible tokens. A highly generic name is more likely to set it apart because other tokens are likely to have specializations or target specific use cases they can be named after. Also, any ambiguity can be addressed by calling it SEP-14? |
What
Add a Soroban token interface proposal.
Why
See the motivation section for why this specific proposal.