Generate extended contract metadata

Sergej Kostjucenko requested to merge aj-metadata into master

Created by: ascjones

Closes #57 (closed). Part of https://github.com/paritytech/ink/issues/299.

Generates extended metadata described here: https://github.com/paritytech/ink/issues/299#issuecomment-651132343 (reproduced below)

  • In root:
    • metadata_version: Required semantic version for the smart contract metadata.
  • In source section:
    • hash: Required of the associated Wasm file using BLAKE2 256-bit
    • language: e.g. Solidity, AssemblyScript or Rust (including version X.Y.Z (semantic versioning))
    • compiler: e.g. Solang, ink!/Rust (including version X.Y.Z (semantic versioning))
  • In contract section:
    • name: Required identifier for the smart contract name. (https://crates.io/crates/unicode-xid)
    • version: Required semantic version field for the smart contract.
    • authors: Required non-empty sequence of strings.
    • description: Optional short description about the smart contract.
    • documentation: Optional URL to link to API-level documentation of the smart contract.
    • repository: Optional URL to link to the repository.
    • homepage: Optional URL to link to the smart contract's associated homepage.
    • license: Optional field to identify the license of the smart contract given in SPDX license list 3.6 format OR a URL to a user provided non-standard license.
  • Add user section for custom metadata fields that are generally ignored by standard tools.

Types for the extended metadata are defined in cargo-contract and combined with metadata generated by ink_lang. This maintains minimal coupling with ink! allowing for forwards/backwards compatibility. See the reasoning here https://github.com/paritytech/ink/issues/299#issuecomment-656750372.

Merge request reports