-
Notifications
You must be signed in to change notification settings - Fork 131
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 #370 from CosmWasm/cw20-logo-spec
Cw20 logo spec
- Loading branch information
Showing
10 changed files
with
347 additions
and
3 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,24 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "DownloadLogoResponse", | ||
"description": "When we download an embedded logo, we get this response type. We expect a SPA to be able to accept this info and display it.", | ||
"type": "object", | ||
"required": [ | ||
"data", | ||
"mime_type" | ||
], | ||
"properties": { | ||
"data": { | ||
"$ref": "#/definitions/Binary" | ||
}, | ||
"mime_type": { | ||
"type": "string" | ||
} | ||
}, | ||
"definitions": { | ||
"Binary": { | ||
"description": "Binary is a wrapper around Vec<u8> to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec<u8>", | ||
"type": "string" | ||
} | ||
} | ||
} |
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,65 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "MarketingInfoResponse", | ||
"type": "object", | ||
"properties": { | ||
"description": { | ||
"description": "A longer description of the token and it's utility. Designed for tooltips or such", | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
}, | ||
"logo": { | ||
"description": "A link to the logo, or a comment there is an on-chain logo stored", | ||
"anyOf": [ | ||
{ | ||
"$ref": "#/definitions/LogoInfo" | ||
}, | ||
{ | ||
"type": "null" | ||
} | ||
] | ||
}, | ||
"marketing": { | ||
"description": "The address (if any) who can update this data structure", | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
}, | ||
"project": { | ||
"description": "A URL pointing to the project behind this token.", | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
} | ||
}, | ||
"definitions": { | ||
"LogoInfo": { | ||
"description": "This is used to display logo info, provide a link or inform there is one that can be downloaded from the blockchain itself", | ||
"anyOf": [ | ||
{ | ||
"type": "string", | ||
"enum": [ | ||
"embedded" | ||
] | ||
}, | ||
{ | ||
"description": "A reference to an externally hosted logo. Must be a valid HTTP or HTTPS URL.", | ||
"type": "object", | ||
"required": [ | ||
"url" | ||
], | ||
"properties": { | ||
"url": { | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
] | ||
} | ||
} | ||
} |
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,38 @@ | ||
use cosmwasm_std::Binary; | ||
use schemars::JsonSchema; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// This is used for uploading logo data, or setting it in InstantiateData | ||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] | ||
#[serde(rename_all = "snake_case")] | ||
pub enum Logo { | ||
/// A reference to an externally hosted logo. Must be a valid HTTP or HTTPS URL. | ||
Url(String), | ||
/// Logo content stored on the blockchain. Enforce maximum size of 5KB on all variants | ||
Embedded(EmbeddedLogo), | ||
} | ||
|
||
/// This is used to store the logo on the blockchain in an accepted format. | ||
/// Enforce maximum size of 5KB on all variants. | ||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] | ||
#[serde(rename_all = "snake_case")] | ||
pub enum EmbeddedLogo { | ||
/// Store the Logo as an SVG file. The content must conform to the spec | ||
/// at https://en.wikipedia.org/wiki/Scalable_Vector_Graphics | ||
/// (The contract should do some light-weight sanity-check validation) | ||
Svg(Binary), | ||
/// Store the Logo as a PNG file. This will likely only support up to 64x64 or so | ||
/// within the 5KB limit. | ||
Png(Binary), | ||
} | ||
|
||
/// This is used to display logo info, provide a link or inform there is one | ||
/// that can be downloaded from the blockchain itself | ||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] | ||
#[serde(rename_all = "snake_case")] | ||
pub enum LogoInfo { | ||
/// A reference to an externally hosted logo. Must be a valid HTTP or HTTPS URL. | ||
Url(String), | ||
/// There is an embedded logo on the chain, make another call to download it. | ||
Embedded, | ||
} |
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.