-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #214 from onflow/giovanni/add-evm-metadata-impl
Add EVMBridgedMetadata view implementation
- Loading branch information
Showing
14 changed files
with
233 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Struct `EVMBridgedMetadata` | ||
|
||
```cadence | ||
pub struct EVMBridgedMetadata { | ||
pub let name: String | ||
pub let symbol: String | ||
pub let uri: {File} | ||
} | ||
``` | ||
|
||
This view may be used by Cadence-native projects to define contract- | ||
and token-level metadata according to EVM-compatible formats. Several | ||
ERC standards (e.g. ERC20, ERC721, etc.) expose name and symbol values | ||
to define assets as well as contract- & token-level metadata view | ||
`tokenURI(uint256)` and `contractURI()` methods. This view enables | ||
Cadence projects to define in their own contracts how they would like | ||
their metadata to be defined when bridged to EVM. | ||
|
||
### Initializer | ||
|
||
```cadence | ||
init(name: String, symbol: String, uri: {File}) | ||
``` | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Struct `URI` | ||
|
||
```cadence | ||
pub struct URI { | ||
pub let baseURI: String? | ||
access(self) let value: String | ||
} | ||
``` | ||
|
||
View to represent a generic URI. May be used to represent the URI of | ||
the NFT where the type of URI is not able to be determined (i.e. HTTP, | ||
IPFS, etc.) | ||
|
||
Implemented Interfaces: | ||
- `File` | ||
|
||
|
||
### Initializer | ||
|
||
```cadence | ||
init(baseURI: String?, value: String?) | ||
``` | ||
|
||
|
||
## Functions | ||
|
||
### `uri()` | ||
|
||
```cadence | ||
view fun uri(): String | ||
``` | ||
This function returns the uri for this file. If the `baseURI` is set, | ||
this will be a concatenation of the `baseURI` and the `value`. If the | ||
`baseURI` is not set, this will return the `value`. | ||
|
||
Returns: The string containing the file uri | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.