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
Proposing an access module to make contract sellable: Sellable.sol an… #2887
Proposing an access module to make contract sellable: Sellable.sol an… #2887
Conversation
I like this proposal. |
Hello @Lcressot. Thank you for taking the time to propose contracts that offer new functionalities. We would however prefer if these features were discussed in an issue, so the exact requirements can be sorted out before any work is put into the code. What you are proposing reminds me of a project I built a few years back. NFWallet are contracts (smart wallets) that are owned through an NFT. This created the ability to transfer & sell contract it using existing marketplaces (opensea). The "selling" part of your proposal doesn't follow any standard. I would encourage you to pursue that first. Also, I would argue that your code would deserve a lot of improvement before being ready:
IMO, for this feature to make it into OpenZeppelin contract, we would need a clear use-case, where this approach would be more effective than using NFTs AND a standardized interface (ERC) that would have been vetted by the community. |
Hi @Amxx Thanks for your short and full answer. Sorry I didn't open an issue about it first, it's my first time contributing. I will answer to your comments here and I also opened an issue as you said: #2889
|
It true that you would need a trusted external NFT registry, but that would be easy to write, either for you application, or a generic one that any app could use. For example:
This is why I recently pushed for this commit. I think your extension of Ownable would have been a strong motivation to add this feature earlier ... but most people don't share their needs and fork code instead (that is a shame). Whenever you are limited by something like this, please share it so we can have the contract evolve in the right direction. For the ERC part, my argument is to create a new ERC that documents the additional functions (on top of ERC173) and behaviors that would be define the ownable-sellable part |
@Amxx I agree with your commit, it would solve a big part of my problem, allowing the Sellable to make ownership transfer. However it would mean that all inheriting class could make such a transfer, and I don't know if it would be good. |
Have a look at the code, the two are strictly identical. Using My argument with that being better, is that marketplaces and mechanisms to sell NFT are already widely available, which is not the case of your (non-standard) interface. |
@Amxx I think it could be a great solution if we also added the methods I have proposed to make the owner able to make a direct sale to a buyer without using a proxy market place. These methods could be suject to a new standard, or not. I think they are important because for now there are no market places for contract and owners are more likely to be willing to make a direct safe sale. However this solution would require to depend on an external trusted registry as you said and it could complicate things in practice. |
I had some thought about your proposal, and I now think the first points are a bad idea. Let me explain why. ERC20 doesn't include any buy/sell logic. It doesn't include any built in AMM mechanism. What is great about ERC20 is that its simple and effective enough so that other contract (Crowdsale, Uniswap, ...) can operate on it, and implement complex logic. Also, you can come up with a new design for an AMM and still be compatible with old tokens. ERC721 also doesn't include any sale/auction mechanism. it only deal with token transfer/approval ... and then third parties (like Opensea) do create contract that take benefit of the transfer mechanism to externally implement marketplaces. IMO, the same logic should apply to selling Ownable contract. If you code some mechanism in the contract, you are making an opinionated choice about who the sales should look like. I think this is bad, because you don't know in advance if your choices will still be relevant in 1, 3, 10 years. I believe it would be way simpler, cleaner, and more effective, to just improve the compatibility of Ownable with third-party transfers. This is what I do with the We can imagine
This mechanism is simple, light, versatile, and allow third party contract to handle sell So I would go for ONLY including these 2 points
|
Here is an example of what a settling contract could look like.
It would be very easy to change it to accept payment using ERC20, or NFTs, which your approach will not support. |
I agree with @Amxx on this, making this loosely coupled would enable anyone cater for use-cases that would be relevant beyond just 1 years, even in +10years to come. part of the implications of writing smart contracts is that once they are deployed on-chain, you're almost stuck with it. Also looking at the |
@Amxx If I get you right we must wait that Ownable._setOwner gets updated to internal to be able to make this call: Not important note:
|
The seller (owner) set the price for a specific buyer, or for any buyer (address(0)). |
@Amxx |
We would need the I believe @fulldecent is attached to this ownability transfer mechanism and might have an opinion to share. |
I do not support this PR and think it should be closed. Here's why. NFT are easy to review and compare. You can look at one CryptoKitty and look at another one. Looking at one helps you understand the other. Even non-technical people have an opinion on which ones they like. There are whole websites and wallets dedicated to helping you look at them and compare them. Pricing them and determining value is a whole study by itself. There is a market to buy any and all Kitties. There are floor prices. People track the floor prices. There is no such market for Ethereum contracts. Expert review of just one contract costs about USD 10,000–100,000. And you should review them before you buy them! If you don't read contracts before you buy them you will get scammed. Go and read the obfuscated Solidity contracts and compare to any popular NFT contract, can you tell which is backdoored? Because this is not a liquid market, because nobody current does this, and because there is no standard, I think it is clear that this should be outside the scope of OpenZeppelin Contracts. Now, if you want to create a marketplace for selling contracts, that's great. You should make your own custody smart contract, it can be compatible with |
100% agree on that. I think I made it clear that the first step would be to have this standardized
We would not bloat every contract, as this would be an opt-in extension to Ownable, that most people would possibly not use. It is true that it would mostly make sense for families or similar smart contracts (such as on-chain wallets?) for which the behaviour is known and understood. I also think that having a custody wrapper would be the best option. However, I do have to admit that building such a custody system with the current |
@fulldecent Then I thought I could also allow a proxy to make the transfer and we discussed it with @Amxx and his view was more to abandon my first solution and make it compatible with ERC. Given your argument, if the NFT/ERC option is out of the table, I think it would still be interesting to allow an owner to make a safe paid transfer, and maybe forget the proxy and ERC marketplace option. However it is not impossible that in the future such marketplaces could emerge, taking a commission on the sale to get experts reviewing and auditing the code. Contracts will most probably never be traded like traditional NFTs but their could be a special trading procedure for them. |
@Lcressot You use the world ERC in a disturbing way. For the record, and ERC is an Ethereum Request for Comment. This is the format used to standardized anything in the ethereum ecosystems. There are many of these, including ERC20 (that is the standard used by most fungible tokens) and ERC721 (that is the standard used by most non fungible tokens). The current Ownable contract follows ERC173, which describes how ownable contract should behave (public functions, emitted events, ...). If you were to build a marketplace for ownable contracts, you are obviously free to do it, but I really don't think it falls under the scope of OpenZeppelin. On the other hand, if the ERC173 standard includes some limitation, and if "Ownable" needs an extension to improve the feasibility of such a marketplace, then a NEW ERC173 (that extends 173) would possibly be welcome by the community and implemented by OpenZeppelin. Hence, my proposition is that, if you feel like your usecase would need an extension of ERC173 (which supports some variation of |
Discussion should continue at #2889 |
Sellable: an extension of Ownable module to make contract ownership sellable. The module has a copy paste of Ownable inside it*, then it defines new methods to :
Fixes #???? None
PR Checklist