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

Adds metadata views to FlowToken and removes init parameter #370

Merged
merged 10 commits into from
Jul 13, 2023

Conversation

joshuahannan
Copy link
Member

@joshuahannan joshuahannan commented Jun 27, 2023

Adds standard fungible token metadata views to the FlowToken smart contract
Also removes the init parameter from the contract so that it is easier for users to deploy it to the playground

@joshuahannan joshuahannan changed the title Adds metadata views and removes init parameter Adds metadata views to FlowToken and removes init parameter Jun 27, 2023
contracts/FlowToken.cdc Outdated Show resolved Hide resolved
contracts/FlowToken.cdc Show resolved Hide resolved
contracts/FlowToken.cdc Show resolved Hide resolved
case Type<FungibleTokenMetadataViews.FTDisplay>():
let media = MetadataViews.Media(
file: MetadataViews.HTTPFile(
url: "https://assets.website-files.com/5f6294c0c7a8cdd643b1c820/5f6294c0c7a8cda55cb1c936_Flow_Wordmark.svg"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know where this is hosted? It'd be great to get this pinned in IPFS or some other Web3 native solution.

Copy link
Member Author

@joshuahannan joshuahannan Jul 3, 2023

Choose a reason for hiding this comment

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

Not sure actually. yeah IPFS would be great. I'd like to get this merged first though and then we can start looking into it in the future

Copy link
Member Author

Choose a reason for hiding this comment

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

We might just store it on chain in xml format since it is small

Copy link
Member Author

Choose a reason for hiding this comment

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

Anybody have any ideas about which metadata view would be the best to use for storing an entire XML file? This one would only be about 2KB so we can probably just store it all on chain, but I don't know which one to use or if we have to create a new view for it

Copy link
Contributor

@bluesign bluesign Jul 12, 2023

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

So I would just save the entire XML file as a String in the URI field?

Copy link

@austinkline austinkline Jul 12, 2023

Choose a reason for hiding this comment

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

So long as you encode the start with the right preface that should work, I think. Only returning the string won't tell platforms how to interpret the data being returned

Copy link
Contributor

@bluesign bluesign Jul 12, 2023

Choose a reason for hiding this comment

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

it will be:

data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNDAgMTAwIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6IzIzMWYyMDt9LmNscy0ye2ZpbGw6IzAwZWY4Yjt9LmNscy0ze2ZpbGw6I2ZmZjt9LmNscy00e2ZpbGw6IzE2ZmY5OTt9PC9zdHlsZT48L2RlZnM+PGcgaWQ9IkxheWVyXzIiIGRhdGEtbmFtZT0iTGF5ZXIgMiI+PGcgaWQ9IkxheWVyXzEtMiIgZGF0YS1uYW1lPSJMYXllciAxIj48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0xMzcuNjgsNDkuODhoLTYuNDVWNzMuOTNoLTlWNDkuODhoLTQuNjVWNDIuMTdoNC42NXYtM2MwLTcuNzcsNC44NS0xMS43NiwxMi4yMi0xMS43NmExNS42OCwxNS42OCwwLDAsMSwzLjM5LjR2OWE4LjM1LDguMzUsMCwwLDAtMy4wNS0uNiwzLjI4LDMuMjgsMCwwLDAtMy41MywzLjUydjIuMzloNi40NVptMTMuNTUsMjQuMDVoLTkuMVYyOC4wOWg5LjFaIi8+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNMTcxLjQzLDQwLjE4YTE3LjI0LDE3LjI0LDAsMSwxLTE3LjIxLDE3LjIxQTE3LDE3LDAsMCwxLDE3MS40Myw0MC4xOFptMCwyNS42NWM0LjY1LDAsOC0zLjg2LDgtOC40NGE4LDgsMCwwLDAtOC04LjM3LDguNDEsOC40MSwwLDAsMCwwLDE2LjgxWiIvPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTE5OC4xNCw0MC44NWw1Ljg1LDIyLDUuODUtMTcuNDgtMS42LTQuNTFoOWw3LjcxLDIyLDUuNzEtMjJIMjQwbC05LjgzLDMzLjA4aC05LjQ0TDIxNC4xNSw1NS44LDIwOCw3My45M2gtOS41bC05Ljc3LTMzLjA4WiIvPjxjaXJjbGUgY2xhc3M9ImNscy0yIiBjeD0iNTAiIGN5PSI1MCIgcj0iNTAiLz48cmVjdCBjbGFzcz0iY2xzLTMiIHg9IjU3LjgyIiB5PSI0Mi4xOCIgd2lkdGg9IjE0LjEyIiBoZWlnaHQ9IjE0LjEyIi8+PHBhdGggY2xhc3M9ImNscy0zIiBkPSJNNDMuNzEsNjEuNTlhNS4zLDUuMywwLDEsMS01LjMtNS4zaDUuM1Y0Mi4xOGgtNS4zQTE5LjQxLDE5LjQxLDAsMSwwLDU3LjgyLDYxLjU5di01LjNINDMuNzFaIi8+PHBhdGggY2xhc3M9ImNscy0zIiBkPSJNNjMuMTIsMzUuMTJINzlWMjFINjMuMTJBMTkuNDMsMTkuNDMsMCwwLDAsNDMuNzEsNDAuNDF2MS43N0g1Ny44MlY0MC40MUE1LjMsNS4zLDAsMCwxLDYzLjEyLDM1LjEyWiIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtNCIgcG9pbnRzPSI0My43MSA1Ni4yOSA1Ny44MiA1Ni4yOSA1Ny44MiA1Ni4yOSA1Ny44MiA0Mi4xOCA1Ny44MiA0Mi4xOCA0My43MSA0Mi4xOCA0My43MSA1Ni4yOSIvPjwvZz48L2c+PC9zdmc+

@joshuahannan
Copy link
Member Author

Tests are passing, but I'm having a hard time getting CI to pass because there are diffs in lib/go/test/go.sum that I don't know how to resolve properly. I have to get to some other things, so I will come back to this in a couple days

contracts/FlowToken.cdc Show resolved Hide resolved
contracts/FlowToken.cdc Show resolved Hide resolved
@joshuahannan joshuahannan merged commit 241193d into master Jul 13, 2023
1 check passed
@joshuahannan joshuahannan deleted the flow-token-metadata branch July 13, 2023 15:09
bors bot added a commit to onflow/flow-go that referenced this pull request Jul 14, 2023
4536: Update bootstrapping to include nft and metadata views r=janezpodhostnik a=joshuahannan

In onflow/flow-core-contracts#370, we're adding metadata views to the `FlowToken` smart contract. For this, the contract needs to implement all the metadata views contracts. This PR updates the bootstrapping logic to deploy `NonFungibleToken`, `MetadataViews`, `ViewResolver`, and `FungibleTokenMetadataViews` and provide those import addresses to the `FlowToken` smart contract deployment.

Co-authored-by: Josh Hannan <hannanjoshua19@gmail.com>
Co-authored-by: Janez Podhostnik <janez.podhostnik@gmail.com>
Co-authored-by: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com>
bors bot added a commit to onflow/flow-go that referenced this pull request Jul 14, 2023
4536: Update bootstrapping to include nft and metadata views r=janezpodhostnik a=joshuahannan

In onflow/flow-core-contracts#370, we're adding metadata views to the `FlowToken` smart contract. For this, the contract needs to implement all the metadata views contracts. This PR updates the bootstrapping logic to deploy `NonFungibleToken`, `MetadataViews`, `ViewResolver`, and `FungibleTokenMetadataViews` and provide those import addresses to the `FlowToken` smart contract deployment.

Co-authored-by: Josh Hannan <hannanjoshua19@gmail.com>
Co-authored-by: Janez Podhostnik <janez.podhostnik@gmail.com>
Co-authored-by: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com>
bors bot added a commit to onflow/flow-go that referenced this pull request Jul 17, 2023
4536: Update bootstrapping to include nft and metadata views r=janezpodhostnik a=joshuahannan

In onflow/flow-core-contracts#370, we're adding metadata views to the `FlowToken` smart contract. For this, the contract needs to implement all the metadata views contracts. This PR updates the bootstrapping logic to deploy `NonFungibleToken`, `MetadataViews`, `ViewResolver`, and `FungibleTokenMetadataViews` and provide those import addresses to the `FlowToken` smart contract deployment.

Co-authored-by: Josh Hannan <hannanjoshua19@gmail.com>
Co-authored-by: Janez Podhostnik <janez.podhostnik@gmail.com>
Co-authored-by: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com>
bors bot added a commit to onflow/flow-go that referenced this pull request Jul 17, 2023
4536: Update bootstrapping to include nft and metadata views r=janezpodhostnik a=joshuahannan

In onflow/flow-core-contracts#370, we're adding metadata views to the `FlowToken` smart contract. For this, the contract needs to implement all the metadata views contracts. This PR updates the bootstrapping logic to deploy `NonFungibleToken`, `MetadataViews`, `ViewResolver`, and `FungibleTokenMetadataViews` and provide those import addresses to the `FlowToken` smart contract deployment.

Co-authored-by: Josh Hannan <hannanjoshua19@gmail.com>
Co-authored-by: Janez Podhostnik <janez.podhostnik@gmail.com>
Co-authored-by: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com>
bors bot added a commit to onflow/flow-go that referenced this pull request Jul 17, 2023
4536: Update bootstrapping to include nft and metadata views r=janezpodhostnik a=joshuahannan

In onflow/flow-core-contracts#370, we're adding metadata views to the `FlowToken` smart contract. For this, the contract needs to implement all the metadata views contracts. This PR updates the bootstrapping logic to deploy `NonFungibleToken`, `MetadataViews`, `ViewResolver`, and `FungibleTokenMetadataViews` and provide those import addresses to the `FlowToken` smart contract deployment.

Co-authored-by: Josh Hannan <hannanjoshua19@gmail.com>
Co-authored-by: Janez Podhostnik <janez.podhostnik@gmail.com>
Co-authored-by: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com>
bors bot added a commit to onflow/flow-go that referenced this pull request Jul 17, 2023
4536: Update bootstrapping to include nft and metadata views r=janezpodhostnik a=joshuahannan

In onflow/flow-core-contracts#370, we're adding metadata views to the `FlowToken` smart contract. For this, the contract needs to implement all the metadata views contracts. This PR updates the bootstrapping logic to deploy `NonFungibleToken`, `MetadataViews`, `ViewResolver`, and `FungibleTokenMetadataViews` and provide those import addresses to the `FlowToken` smart contract deployment.

Co-authored-by: Josh Hannan <hannanjoshua19@gmail.com>
Co-authored-by: Janez Podhostnik <janez.podhostnik@gmail.com>
Co-authored-by: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com>
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.

5 participants