Mina smart contract URI

I have noticed that current account of Mina smart contract has a property zkappUri which we can set if we have the correct permission.

I do not think that any of the MIP drafts addressed this property.

For example, on MinaScan Berkley testnet there is an image field, which no token seems to access. Minascan Block Explorer

Here is my attempt: Minascan Block Explorer

I have managed to add a uri link, but not an image field.

Personally, ERC-1046: tokenURI Interoperability seems a viable interface implementation standard solution.

ERC-1046 has further details regarding the metadata.

/**
 * Asset Metadata
 */
interface ERC20TokenMetadata {
    /**
     * Interoperabiliy, to differentiate between different types of tokens and their corresponding URIs.
     **/
    interop: InteroperabilityMetadata;
    
    /**
     * The name of the ERC-20 token. 
     * If the `name()` function is present in the ERC-20 token and returns a nonempty string, these MUST be the same value.
     */
    name?: string;
    
    /**
     * The symbol of the ERC-20 token. 
     * If the `symbol()` function is present in the ERC-20 token and returns a nonempty string, these MUST be the same value.
     */
    symbol?: string;
    
    /**
     * The decimals of the ERC-20 token. 
     * If the `decimals()` function is present in the ERC-20 token, these MUST be the same value.
     * Defaults to 18 if neither this parameter nor the ERC-20 `decimals()` function are present.
     */
    decimals?: number;
    
    /**
     * Provides a short one-paragraph description of the ERC-20 token, without any markup or newlines.
     */
    description?: string;
    
    /**
     * A URI pointing to a resource with mime type `image/*` that represents this token.
     * If the image is a bitmap, it SHOULD have a width between 320 and 1080 pixels
     * The image SHOULD have an aspect ratio between 1.91:1 and 4:5 inclusive.
     */
    image?: string;
    
    /**
     * One or more URIs each pointing to a resource with mime type `image/*` that represents this token.
     * If an image is a bitmap, it SHOULD have a width between 320 and 1080 pixels
     * Images SHOULD have an aspect ratio between 1.91:1 and 4:5 inclusive.
     */
    images?: string[];
    
    /**
     * One or more URIs each pointing to a resource with mime type `image/*` that represent an icon for this token.
     * If an image is a bitmap, it SHOULD have a width between 320 and 1080 pixels, and MUST have a height equal to its width
     * Images MUST have an aspect ratio of 1:1, and use a transparent background
     */
    icons?: string[];
}

On decimals

Further, I am delving into ERC 20:

https://eips.ethereum.org/EIPS/eip-20#decimals

The amount of decimals by default is 18 in ERC 20.

On MinaScan I do not think that the explorer takes into account the decimals value.

On Pin Save smart contract I had to use 1_000_000_000 to get a display of 1 Unit.

Hence, default value of decimals is 9.

Miscellaneous Recommendations

Adapting recommendations from ERC-1046:

Not to implement the name(), symbol(), or decimals() functions, and instead to only include them in the metadata URI.

Additionally, for tokens, if the decimals is 9, then it is NOT RECOMMENDED to include the decimals field in the metadata.

An example of uri.json

{
  "name": "PinSave Mina Token",
  "symbol": "PINSAV",
  "image": "https://pinsave.app/Pin.png"
}

Available at https://pinsave.app/uri.json

1 Like