-
Notifications
You must be signed in to change notification settings - Fork 53
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
FEATURE: V2 FungibleToken Standard #131
Conversation
Would it be possible at all for a Vault in FT to optionally contain the address it was withdrawn from? Just beeing able to look at that to know who is paying for things would make some things way easier. |
I think this can be very good case for attachments. Extra metadata like this can be added as an attachment maybe. |
I just pushed changes to the standard based on the discussions we've been having in the standard breakout sessions, including events emitted from interfaces.
I agree this could be good for attachments. It would be possible to do this in a way with the standard, but idk if it is safe |
Can we get some eyes on this to ensure if it is safe or not? |
It is kind of similar to the |
995c873
to
73a5ba8
Compare
9a46ad8
to
95c819f
Compare
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.
🚀
@bjartek proposed that we add a Unfortunately, we can't do this for the |
Does anybody remember why we emit Withdrawn events from the Provider and Deposited from the Vault? Because it would be very very nice to have this for withdraw events too. |
After thinking about it a little bit, I am pretty sure that the reason that the |
I opened a PR for this in the FT repo: #158 Looking for reviews! :) |
There're 2 more questions open for discussion based on recent experiments:
For (1):
For (2):
Open questions:
|
Those are really good points ( use cases) @dryruner. Especially with EVM bridging coming, those can have unintended consequences. Not sure what would be the correct approach here to be honest. Mapping ERC20 to Flow is troublesome in general. Flow having upgradable contracts and different ownership model makes it super complicated. For example if we remove I would say transfer-tax tokens and rebase tokens maybe need a new standard with a bit more lax with requirements. |
Yes, thank you for bringing this up, @dryruner! We actually used to have a As for the transfer-tax tokens, I am a little conflicted about that. I like having the post-condition there just to make sure that regular implementations are honest, but now that I think about it, removing it wouldn't be a huge problem because it would be pretty obvious if implementations are doing something different without making it clear to users. I think I would be okay with removing it, but I want to see what others think first and I want to spend a little more time thinking about it. Luckily, both of these changes would not be breaking, so we don't necessarily need to be in a hurry to get it done before Cadence 1.0. I can put them on the agenda for the next smart contract open house to talk about if we don't have any other pressing topics. |
For 1) I'm conflicted because this is ultimately very easy to override in Cadence since ultimately the holder of the Vault has full authority on how that Vault is transferred - a holder could use a wrapper to move the Vault to another account in its full denomination and basically treat the balance as one would treat bills. Ultimately, it's as @bluesign said, translating ERC20 features to Cadence 1-to-1 leads to some odd constructions - feels a bit like putting up a fence those in the know can simply walk around. However, I understand wanting to have parity with emergent features in other ecosystems. My $0.02 would be that even though these wouldn't be breaking changes, the pre-/post-conditions built into the standard could quickly become implicit interfaces that implementers take for granted and as such we should decide on whether to include them sooner rather than later or at least document that consensus may lead to the future removal of these conditions. |
I think removing post conditions from existing interfaces are pretty bad in general, there are codes relying on that protections. myVault.deposit(from: <- ftProvider.withdraw(amount: amount)) for example this code makes 2 assumptions:
if we change this assumptions, all code relying on them should be updated. |
Yeah, after thinking about it some more, I am pretty sure that both of these use cases can be built to be compatible with the existing token standards without requiring any changes, so I would probably recommend exploring that first before we make any of the suggested changes. |
Agreed with @joshuahannan , for 1 ) you can use allowance, you send tax to vault ( which burns or sends to treasury ) and increases you allowance ( you send 5 tokens, your allowance increases 95 etc ) so you can send 95 tokens afterwards. Practically same thing. for 2) you can make a new interface, let's say |
I think that it is time to merge this to master! If nobody has any issues with me merging this, I'll merge it on Monday once we've tested it with the latest CLI version. I'm going to create a branch that is based off current master so that we still have a record of the cadence 0.42 versions of the contracts too. |
Amazing work everyone! 👏 |
This is a different PR from the original one because the git organization had gotten out of sync
Adds the v2 fungible token standard, as described in this flip: onflow/flips#55
A few highlights:
FungibleToken
into a contract instead of a contract interfaceTransferable
interface to include a transfer functioncreateEmptyVault
into the vault resourceThere are probably more that I am missing, but most of the details are in the forum post, so that is another good resource.