Skip to content
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

added FungibleTokens contract (plural!) #60

Closed
wants to merge 4 commits into from

Conversation

justjoolz
Copy link

Added FungibleTokens contract

#59

Copy link
Member

@joshuahannan joshuahannan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for proposing this! Great suggestions. Like I said in the issue, we have a rough draft of a more fundamental change to the standard that we are going to propose soon, so this might not be needed, but if the community decides that we don't want to have to go through managing all those breaking changes, then this might be a great start for a alternate solution.

contracts/ExampleTokens.cdc Outdated Show resolved Hide resolved
}
}

pub resource Collection: FungibleTokens.CollectionPublic, FungibleTokens.CollectionPrivate {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love the idea of having collections for multiple fungible tokens. I think we'll definitely want to integrate something like this in the standard

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I basically tried to create something that follows existing patterns from FT/NFT interfaces as there has been very little talk of updating the existing standard and the longer they are left in their current form the greater the friction breaking changes will introduce.


init() {
self.totalSupplyByID = {0: 1000.0}
self.CollectionStoragePath = /storage/ExampleTokens
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably needs a more specific name

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you referring to CollectionStoragePath or the example storage path?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path value itself. Maybe something like /storage/flowFungibleTokenExampleCollection

contracts/FungibleTokens.cdc Outdated Show resolved Hide resolved

// Requirement that all conforming TokenVault smart contracts have
// to define a resource called TokenVault that conforms to Provider, Receiver, Balance
pub resource TokenVault: Provider, Receiver, Balance {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it would probably be good to also have this implement the FungibleToken.Provider, FungibleToken.Receiver, and FungibleToken.Balance interfaces

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would that work? (they return different Types and we can't use the existing Vault as it has no ID)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They have different types, but you can always cast those to the correct type if needed. It would make this more interoperable

Copy link
Author

@justjoolz justjoolz Feb 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @joshuahannan I still don't see how the interfaces can be compatible/conformant, do you mind showing me how that might work?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. I was assuming that these still were compatible with FungibleToken, but of course they aren't. I don't think this will work then because they would still need to be compatible. We're working on the new proposal so we'll be sharing it soon.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea is to introduce this as a new standard not to replace the existing one, so anyone who wants to support these tokens could integrate the complementary 'plural' standard.

Main drawback with breaking change to FT I see is how long will it take for exchanges to update? They already struggle with the smallest change....

contracts/FungibleTokens.cdc Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants