mirror of
https://github.com/status-im/EIPs.git
synced 2025-02-24 04:38:29 +00:00
2125 lines
52 KiB
Markdown
2125 lines
52 KiB
Markdown
|
---
|
|||
|
eip: 2678
|
|||
|
title: Revised Ethereum Smart Contract Packaging Standard (EthPM v3)
|
|||
|
author: g. nicholas d’andrea (@gnidan), Piper Merriam (@pipermerriam), Nick Gheorghita (@njgheorghita), Christian Reitwiessner(@chriseth), Ben Hauser (@iamdefinitelyahuman), Bryant Eisenbach (@fubuloubu)
|
|||
|
discussions-to: https://ethereum-magicians.org/t/ethpm-v3-specification-working-group/4086
|
|||
|
status: Draft
|
|||
|
type: Standards Track
|
|||
|
category: ERC
|
|||
|
created: 2020-05-26
|
|||
|
replaces: 1123
|
|||
|
---
|
|||
|
|
|||
|
|
|||
|
## Simple Summary
|
|||
|
|
|||
|
A data format describing a smart contract software package.
|
|||
|
|
|||
|
|
|||
|
## Abstract
|
|||
|
|
|||
|
This EIP defines a data format for *package manifest* documents,
|
|||
|
representing a package of one or more smart contracts, optionally
|
|||
|
including source code and any/all deployed instances across multiple
|
|||
|
networks. Package manifests are minified JSON objects, to be distributed
|
|||
|
via content addressable storage networks, such as IPFS.
|
|||
|
|
|||
|
This document presents a natural language description of a formal
|
|||
|
specification for version **3** of this format.
|
|||
|
|
|||
|
|
|||
|
## Motivation
|
|||
|
|
|||
|
This standard aims to encourage the Ethereum development ecosystem
|
|||
|
towards software best practices around code reuse. By defining an open,
|
|||
|
community-driven package data format standard, this effort seeks to
|
|||
|
provide support for package management tools development by offering a
|
|||
|
general-purpose solution that has been designed with observed common
|
|||
|
practices in mind.
|
|||
|
|
|||
|
As version 3 of this specification, this standard seeks to address a
|
|||
|
number of areas of improvement found for the previous version (defined
|
|||
|
in
|
|||
|
[EIP-1123](https://eips.ethereum.org/EIPS/eip-1123)).
|
|||
|
This version:
|
|||
|
|
|||
|
|
|||
|
- Updates the schema for a *package manifest* to be compatible with
|
|||
|
the [metadata](https://solidity.readthedocs.io/en/latest/metadata.html) output for compilers.
|
|||
|
- Updates the `"sources"` object definition to support a wider range of source file types and serve as [JSON input](https://solidity.readthedocs.io/en/latest/using-the-compiler.html#compiler-input-and-output-json-description) for a compiler.
|
|||
|
- Moves compiler definitions to a top-level `"compilers"` array in order to:
|
|||
|
- Simplify the links between a compiler version, sources, and the
|
|||
|
compiled assets.
|
|||
|
- Simplify packages that use multiple compiler versions.
|
|||
|
- Updates key formatting from `snake_case` to `camelCase` to be
|
|||
|
more consistent with [JSON convention](https://google.github.io/styleguide/jsoncstyleguide.xml?showone=Property_Name_Format#Property_Name_Format).
|
|||
|
|
|||
|
<div id="package-specification"></div>
|
|||
|
|
|||
|
## Specification
|
|||
|
|
|||
|
This document defines the specification for an EthPM package manifest. A
|
|||
|
package manifest provides metadata about a *package*, and
|
|||
|
in most cases should provide sufficient information about the packaged
|
|||
|
contracts and its dependencies to do bytecode verification of its
|
|||
|
contracts.
|
|||
|
|
|||
|
A [hosted version](http://ethpm.github.io/ethpm-spec)
|
|||
|
of this specification is available via GitHub Pages. This EIP and the
|
|||
|
hosted HTML document were both autogenerated from the same documentation
|
|||
|
source.
|
|||
|
|
|||
|
|
|||
|
### Guiding Principles
|
|||
|
|
|||
|
This specification makes the following assumptions about the document
|
|||
|
lifecycle.
|
|||
|
|
|||
|
1. Package manifests are intended to be generated programmatically by
|
|||
|
package management software as part of the release process.
|
|||
|
|
|||
|
2. Package manifests will be consumed by package managers during tasks
|
|||
|
like installing package dependencies or building and deploying new
|
|||
|
releases.
|
|||
|
|
|||
|
3. Package manifests will typically **not** be stored alongside the
|
|||
|
source, but rather by package registries *or* referenced by package
|
|||
|
registries and stored in something akin to IPFS.
|
|||
|
|
|||
|
4. Package manifests can be used to verify public deployments of source
|
|||
|
contracts.
|
|||
|
|
|||
|
|
|||
|
### Conventions
|
|||
|
|
|||
|
#### RFC2119
|
|||
|
|
|||
|
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”,
|
|||
|
“SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this
|
|||
|
document are to be interpreted as described in RFC 2119.
|
|||
|
|
|||
|
- <https://www.ietf.org/rfc/rfc2119.txt>
|
|||
|
|
|||
|
|
|||
|
#### Prefixed vs Unprefixed
|
|||
|
|
|||
|
A [prefixed](#term-prefixed) hexadecimal value begins with `0x`.
|
|||
|
[Unprefixed](#term-unprefixed) values have no prefix. Unless otherwise
|
|||
|
specified, all hexadecimal values **should** be represented with the
|
|||
|
`0x` prefix.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Prefixed</p></td>
|
|||
|
<td><p><code>0xdeadbeef</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Unprefixed</p></td>
|
|||
|
<td><p><code>deadbeef</code></p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
### Document Format
|
|||
|
|
|||
|
The canonical format is a single JSON object. Packages **must** conform
|
|||
|
to the following serialization rules.
|
|||
|
|
|||
|
- The document **must** be tightly packed, meaning no linebreaks or
|
|||
|
extra whitespace.
|
|||
|
|
|||
|
- The keys in all objects **must** be sorted alphabetically.
|
|||
|
|
|||
|
- Duplicate keys in the same object are invalid.
|
|||
|
|
|||
|
- The document **must** use
|
|||
|
[UTF-8](https://en.wikipedia.org/wiki/UTF-8)
|
|||
|
encoding.
|
|||
|
|
|||
|
- The document **must** not have a trailing newline.
|
|||
|
|
|||
|
- To ensure backwards compatibility, `manifest_version` is a forbidden
|
|||
|
top-level key.
|
|||
|
|
|||
|
|
|||
|
### Document Specification
|
|||
|
|
|||
|
The following fields are defined for the package. Custom fields **may**
|
|||
|
be included. Custom fields **should** be prefixed with `x-` to prevent
|
|||
|
name collisions with future versions of the specification.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>See Also</p></td>
|
|||
|
<td><p>Formalized (<a href="https://json-schema.org">JSON-Schema</a>) version of this specification: <a href="https://github.com/ethpm/ethpm-spec/blob/master/spec/v3.spec.json">package.spec.json</a></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Jump To</p></td>
|
|||
|
<td><p><a href="#object-definitions">Definitions</a></p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
<div id="manifest"></div>
|
|||
|
|
|||
|
### EthPM Manifest Version: `manifest`
|
|||
|
|
|||
|
The `manifest` field defines the specification version that this
|
|||
|
document conforms to.
|
|||
|
|
|||
|
- Packages **must** include this field.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>manifest</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Allowed Values</p></td>
|
|||
|
<td><p><code>ethpm/3</code></p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
<div id="name"></div>
|
|||
|
|
|||
|
### Package Name: `name`
|
|||
|
|
|||
|
The `name` field defines a human readable name for this package.
|
|||
|
|
|||
|
- Packages **should** include this field to be released on an EthPM
|
|||
|
registry.
|
|||
|
|
|||
|
- Package names **must** begin with a lowercase letter and be
|
|||
|
comprised of only lowercase letters, numeric characters, and the
|
|||
|
dash character `-`.
|
|||
|
|
|||
|
- Package names **must** not exceed 255 characters in length.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>If <code>version</code> is included.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>name</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p><strong>must</strong> match the regular expression <code>^[a-z][-a-z0-9]{0,255}$</code></p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
<div id="version"></div>
|
|||
|
|
|||
|
### Package Version: `version`
|
|||
|
|
|||
|
The `version` field declares the version number of this release.
|
|||
|
|
|||
|
- Packages **should** include this field to be released on an EthPM
|
|||
|
registry.
|
|||
|
|
|||
|
- This value **should** conform to the
|
|||
|
[semver](http://semver.org/) version numbering
|
|||
|
specification.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>If <code>name</code> is included.</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>version</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
<div id="meta"></div>
|
|||
|
|
|||
|
### Package Metadata: `meta`
|
|||
|
|
|||
|
The `meta` field defines a location for metadata about the package which
|
|||
|
is not integral in nature for package installation, but may be important
|
|||
|
or convenient to have on-hand for other reasons.
|
|||
|
|
|||
|
- This field **should** be included in all Packages.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>meta</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p><a href="#package-meta-object">Package Meta Object</a></p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
<div id="sources"></div>
|
|||
|
|
|||
|
### Sources: `sources`
|
|||
|
|
|||
|
The `sources` field defines a source tree that **should** comprise the
|
|||
|
full source tree necessary to recompile the contracts contained in this
|
|||
|
release.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>sources</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Object (String: <a href="#sources-object">Sources Object</a>)</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
<div id="contract-types"></div>
|
|||
|
|
|||
|
### Contract Types: `contractTypes`
|
|||
|
|
|||
|
The `contractTypes` field hosts the [Contract
|
|||
|
Types](#term-contract-type) which have been included in this release.
|
|||
|
|
|||
|
- Packages **should** only include contract types that can be found in
|
|||
|
the source files for this package.
|
|||
|
|
|||
|
- Packages **should not** include contract types from dependencies.
|
|||
|
|
|||
|
- Packages **should not** include abstract contracts in the contract
|
|||
|
types section of a release.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>contractTypes</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Object (String: <a href="#contract-type-object">Contract Type Object</a>)</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p>Keys <strong>must</strong> be valid <a href="#term-contract-alias">Contract Aliases</a>.</p>
|
|||
|
<p> Values <strong>must</strong> conform to the <a href="#contract-type-object">Contract Type Object</a> definition.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
<div id="compilers"></div>
|
|||
|
|
|||
|
### Compilers: `compilers`
|
|||
|
|
|||
|
The `compilers` field holds the information about the compilers and
|
|||
|
their settings that have been used to generate the various
|
|||
|
`contractTypes` included in this release.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>compilers</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Array (<a href="#compiler-information-object">Compiler Information Object</a>)</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
<div id="deployments"></div>
|
|||
|
|
|||
|
### Deployments: `deployments`
|
|||
|
|
|||
|
The `deployments` field holds the information for the chains on which
|
|||
|
this release has [Contract Instances](#term-contract-instance) as well
|
|||
|
as the [Contract Types](#term-contract-type) and other deployment
|
|||
|
details for those deployed contract instances. The set of chains defined
|
|||
|
by the [BIP122 URI](#bip122) keys for this object **must** be
|
|||
|
unique. There cannot be two different URI keys in a deployments field
|
|||
|
representing the same blockchain.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>deployments</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Object (String: Object(String: <a href="#contract-instance-object">Contract Instance Object</a>))</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p>Keys <strong>must</strong> be a valid BIP122 URI chain definition.</p>
|
|||
|
<p>Values <strong>must</strong> be objects which conform to the following format:</p>
|
|||
|
<p>- Keys <strong>must</strong> be valid <a href="#term-contract-instance-name">Contract Instance Names</a>.</p>
|
|||
|
<p>- Values <strong>must</strong> be a valid <a href="#contract-instance-object">Contract Instance Object</a>.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
<div id="build-dependencies"></div>
|
|||
|
|
|||
|
### Build Dependencies: `buildDependencies`
|
|||
|
|
|||
|
The `buildDependencies` field defines a key/value mapping of EthPM
|
|||
|
packages that this project depends on.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>buildDependencies</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Object (String: String)</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p>Keys <strong>must</strong> be valid <a href="#name">package names</a>.</p>
|
|||
|
<p>Values <strong>must</strong> be a <a href="#term-content-addressable-uri">Content Addressable URI</a> which resolves to a valid package that conforms the same EthPM manifest version as its parent.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
<div id="object-definitions"></div>
|
|||
|
|
|||
|
### Definitions
|
|||
|
|
|||
|
Definitions for different objects used within the Package. All objects
|
|||
|
allow custom fields to be included. Custom fields **should** be prefixed
|
|||
|
with `x-` to prevent name collisions with future versions of the
|
|||
|
specification.
|
|||
|
|
|||
|
|
|||
|
<div id="link-reference-object"></div>
|
|||
|
|
|||
|
### The *Link Reference* Object
|
|||
|
|
|||
|
A [Link Reference](#term-link-reference) object has the following
|
|||
|
key/value pairs. All link references are assumed to be associated with
|
|||
|
some corresponding [Bytecode](#term-bytecode).
|
|||
|
|
|||
|
#### Offsets: `offsets`
|
|||
|
|
|||
|
The `offsets` field is an array of integers, corresponding to each of
|
|||
|
the start positions where the link reference appears in the bytecode.
|
|||
|
Locations are 0-indexed from the beginning of the bytes representation
|
|||
|
of the corresponding bytecode. This field is invalid if it references a
|
|||
|
position that is beyond the end of the bytecode.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Array</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
#### Length: `length`
|
|||
|
|
|||
|
The `length` field is an integer which defines the length in bytes of
|
|||
|
the link reference. This field is invalid if the end of the defined link
|
|||
|
reference exceeds the end of the bytecode.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Integer</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
#### Name: `name`
|
|||
|
|
|||
|
The `name` field is a string which **must** be a valid
|
|||
|
[Identifier](#term-identifier). Any link references which **should** be
|
|||
|
linked with the same link value **should** be given the same name.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p><strong>must</strong> conform to the <a href="#term-identifier">Identifier</a> format.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
<div id="link-value-object"></div>
|
|||
|
|
|||
|
### The *Link Value* Object
|
|||
|
|
|||
|
Describes a single [Link Value](#term-link-value).
|
|||
|
|
|||
|
A **Link Value object** is defined to have the following key/value
|
|||
|
pairs.
|
|||
|
|
|||
|
|
|||
|
#### Offsets: `offsets`
|
|||
|
|
|||
|
The `offsets` field defines the locations within the corresponding
|
|||
|
bytecode where the `value` for this link value was written. These
|
|||
|
locations are 0-indexed from the beginning of the bytes representation
|
|||
|
of the corresponding bytecode.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Integer</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p>See Below.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
Format
|
|||
|
|
|||
|
Array of integers, where each integer **must** conform to all of the
|
|||
|
following.
|
|||
|
|
|||
|
- greater than or equal to zero
|
|||
|
|
|||
|
- strictly less than the length of the unprefixed hexadecimal
|
|||
|
representation of the corresponding bytecode.
|
|||
|
|
|||
|
#### Type: `type`
|
|||
|
|
|||
|
The `type` field defines the `value` type for determining what is
|
|||
|
encoded when [linking](#term-linking) the corresponding bytecode.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Allowed Values</p></td>
|
|||
|
<td><p><code>"literal"</code> for bytecode literals</p>
|
|||
|
<p><code>"reference"</code> for named references to a particular <a href="#term-contract-instance">Contract Instance</a></p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
#### Value: `value`
|
|||
|
|
|||
|
The `value` field defines the value which should be written when
|
|||
|
[linking](#term-linking) the corresponding bytecode.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p>Determined based on <code>type</code>, see below.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
Format
|
|||
|
|
|||
|
For static value *literals* (e.g. address), value **must** be a *byte
|
|||
|
string*
|
|||
|
|
|||
|
To reference the address of a [Contract
|
|||
|
Instance](#term-contract-instance) from the current package the value
|
|||
|
should be the name of that contract instance.
|
|||
|
|
|||
|
- This value **must** be a valid [Contract Instance
|
|||
|
Name](#term-contract-instance-name).
|
|||
|
|
|||
|
- The chain definition under which the contract instance that this
|
|||
|
link value belongs to must contain this value within its keys.
|
|||
|
|
|||
|
- This value **may not** reference the same contract instance that
|
|||
|
this link value belongs to.
|
|||
|
|
|||
|
To reference a contract instance from a [Package](#term-package) from
|
|||
|
somewhere within the dependency tree the value is constructed as
|
|||
|
follows.
|
|||
|
|
|||
|
- Let `[p1, p2, .. pn]` define a path down the dependency tree.
|
|||
|
|
|||
|
- Each of `p1, p2, pn` **must** be valid package names.
|
|||
|
|
|||
|
- `p1` **must** be present in keys of the `buildDependencies` for the
|
|||
|
current package.
|
|||
|
|
|||
|
- For every `pn` where `n > 1`, `pn` **must** be present in the keys
|
|||
|
of the `buildDependencies` of the package for `pn-1`.
|
|||
|
|
|||
|
- The value is represented by the string
|
|||
|
`<p1>:<p2>:<...>:<pn>:<contract-instance>` where all of `<p1>`,
|
|||
|
`<p2>`, `<pn>` are valid package names and `<contract-instance>` is
|
|||
|
a valid [Contract Name](#term-contract-name).
|
|||
|
|
|||
|
- The `<contract-instance>` value **must** be a valid [Contract
|
|||
|
Instance Name](#term-contract-instance-name).
|
|||
|
|
|||
|
- Within the package of the dependency defined by `<pn>`, all of the
|
|||
|
following must be satisfiable:
|
|||
|
|
|||
|
- There **must** be *exactly* one chain defined under the
|
|||
|
`deployments` key which matches the chain definition that this
|
|||
|
link value is nested under.
|
|||
|
|
|||
|
- The `<contract-instance>` value **must** be present in the keys
|
|||
|
of the matching chain.
|
|||
|
|
|||
|
<div id="bytecode-object"></div>
|
|||
|
|
|||
|
### The *Bytecode* Object
|
|||
|
|
|||
|
A bytecode object has the following key/value pairs.
|
|||
|
|
|||
|
#### Bytecode: `bytecode`
|
|||
|
|
|||
|
The `bytecode` field is a string containing the `0x` prefixed
|
|||
|
hexadecimal representation of the bytecode.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p><code>0x</code> prefixed hexadecimal.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Link References: `link_references`
|
|||
|
|
|||
|
The `linkReferences` field defines the locations in the corresponding
|
|||
|
bytecode which require [linking](#term-linking).
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Array</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p>All values <strong>must</strong> be valid <a href="#link-reference-object">Link Reference objects</a>. See also below.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
Format
|
|||
|
|
|||
|
This field is considered invalid if *any* of the [Link
|
|||
|
References](#term-link-reference) are invalid when applied to the
|
|||
|
corresponding `bytecode` field, *or* if any of the link references
|
|||
|
intersect.
|
|||
|
|
|||
|
Intersection is defined as two link references which overlap.
|
|||
|
|
|||
|
#### Link Dependencies: `link_dependencies`
|
|||
|
|
|||
|
The `linkDependencies` defines the [Link Values](#term-link-value) that
|
|||
|
have been used to link the corresponding bytecode.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Array</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p>All values <strong>must</strong> be valid <a href="#link-value-object">Link Value objects</a>. See also below.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
Format
|
|||
|
|
|||
|
Validation of this field includes the following:
|
|||
|
|
|||
|
- Two link value objects **must not** contain any of the same values
|
|||
|
for `offsets`.
|
|||
|
|
|||
|
- Each [link value object](#link-value-object) **must** have a
|
|||
|
corresponding [link reference object](#link-reference-object) under
|
|||
|
the `linkReferences` field.
|
|||
|
|
|||
|
- The length of the resolved `value` **must** be equal to the `length`
|
|||
|
of the corresponding [Link Reference](#term-link-reference).
|
|||
|
|
|||
|
|
|||
|
<div id="package-meta-object"></div>
|
|||
|
|
|||
|
### The *Package Meta* Object
|
|||
|
|
|||
|
The *Package Meta* object is defined to have the following key/value
|
|||
|
pairs.
|
|||
|
|
|||
|
#### Authors: `authors`
|
|||
|
|
|||
|
The `authors` field defines a list of human readable names for the
|
|||
|
authors of this package. Packages **may** include this field.
|
|||
|
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>authors</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Array (String)</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
<div id="meta-license"></div>
|
|||
|
|
|||
|
#### License: `license`
|
|||
|
|
|||
|
The `license` field declares the license associated with this package.
|
|||
|
This value **should** conform to the
|
|||
|
[SPDX](https://en.wikipedia.org/wiki/Software_Package_Data_Exchange)
|
|||
|
format. Packages **should** include this field. If a file [Source
|
|||
|
Object](#source-object) defines its own license, that license takes
|
|||
|
precedence for that particular file over this package-scoped `meta`
|
|||
|
license.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>license</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
#### Description: `description`
|
|||
|
|
|||
|
The `description` field provides additional detail that may be relevant
|
|||
|
for the package. Packages **may** include this field.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>description</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
#### Keywords: `keywords`
|
|||
|
|
|||
|
The `keywords` field provides relevant keywords related to this package.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>keywords</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Array(String)</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
#### Links: `links`
|
|||
|
|
|||
|
The `links` field provides URIs to relevant resources associated with
|
|||
|
this package. When possible, authors **should** use the following keys
|
|||
|
for the following common resources.
|
|||
|
|
|||
|
- `website`: Primary website for the package.
|
|||
|
|
|||
|
- `documentation`: Package Documentation
|
|||
|
|
|||
|
- `repository`: Location of the project source code.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>links</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Object (String: String)</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
<div id="sources-object"></div>
|
|||
|
|
|||
|
### The *Sources* Object
|
|||
|
|
|||
|
A *Sources* object is defined to have the following fields.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p>A unique identifier for the source file. (String)</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Value</p></td>
|
|||
|
<td><p><a href="#source-object">Source Object</a></p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
<div id="source-object"></div>
|
|||
|
|
|||
|
### The *Source* Object
|
|||
|
|
|||
|
#### Checksum: `checksum`
|
|||
|
|
|||
|
Hash of the source file.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p><strong>If</strong> there are no URLs present that contain a content hash.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>checksum</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Value</p></td>
|
|||
|
<td><p><a href="#checksum-object">Checksum Object</a></p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### URLS: `urls`
|
|||
|
|
|||
|
Array of urls that resolve to the same source file.
|
|||
|
- Urls **should** be stored on a content-addressable filesystem.
|
|||
|
**If** they are not, then either `content` or `checksum` **must** be
|
|||
|
included.
|
|||
|
|
|||
|
- Urls **must** be prefixed with a scheme.
|
|||
|
|
|||
|
- If the resulting document is a directory the key **should** be
|
|||
|
interpreted as a directory path.
|
|||
|
|
|||
|
- If the resulting document is a file the key **should** be
|
|||
|
interpreted as a file path.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>If <code>content</code> is not included.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>urls</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Value</p></td>
|
|||
|
<td><p>Array(String)</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Content: `content`
|
|||
|
|
|||
|
Inlined contract source. If both `urls` and `content` are provided, the `content` value
|
|||
|
**must** match the content of the files identified in `urls`.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>If <code>urls</code> is not included.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>content</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Value</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Install Path: `installPath`
|
|||
|
|
|||
|
Filesystem path of source file.
|
|||
|
- **Must** be a relative filesystem path that begins with a `./`.
|
|||
|
|
|||
|
- **Must** resolve to a path that is within the current virtual
|
|||
|
working directory.
|
|||
|
|
|||
|
- **Must** be unique across all included sources.
|
|||
|
|
|||
|
- **Must not** contain `../` to avoid accessing files outside of
|
|||
|
the source folder in improper implementations.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>This field <strong>must</strong> be included for the package to be writable to disk.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>installPath</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Value</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Type: `type`
|
|||
|
|
|||
|
The `type` field declares the type of the source file. The field
|
|||
|
**should** be one of the following values: `solidity`, `vyper`,
|
|||
|
`abi-json`, `solidity-ast-json`.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>type</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Value</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### License: `license`
|
|||
|
|
|||
|
The `license` field declares the type of license associated with
|
|||
|
this source file. When defined, this license overrides the
|
|||
|
package-scoped [meta license](#meta-license).
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>license</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Value</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
<div id="checksum-object"></div>
|
|||
|
|
|||
|
### The *Checksum* Object
|
|||
|
|
|||
|
A *Checksum* object is defined to have the following key/value pairs.
|
|||
|
|
|||
|
#### Algorithm: `algorithm`
|
|||
|
|
|||
|
The `algorithm` used to generate the corresponding hash. Possible
|
|||
|
algorithms include, but are not limited to `sha3`, `sha256`, `md5`,
|
|||
|
`keccak256`.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Hash: `hash`
|
|||
|
|
|||
|
The `hash` of a source files contents generated with the corresponding
|
|||
|
algorithm.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
<div id="contract-type-object"></div>
|
|||
|
|
|||
|
### The *Contract Type* Object
|
|||
|
|
|||
|
A *Contract Type* object is defined to have the following key/value
|
|||
|
pairs.
|
|||
|
|
|||
|
#### Contract Name: `contractName`
|
|||
|
|
|||
|
The `contractName` field defines the [Contract
|
|||
|
Name](#term-contract-name) for this [Contract
|
|||
|
Type](#term-contract-type).
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>If the <a href="#term-contract-name">Contract Name</a> and <a href="#term-contract-alias">Contract Alias</a> are not the same.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p><strong>Must</strong> be a valid <a href="#term-contract-name">Contract Name</a>.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Source ID: `sourceId`
|
|||
|
|
|||
|
The global source identifier for the source file from which this
|
|||
|
contract type was generated.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p><strong>Must</strong> match a unique source ID included in the <a href="#sources-object">Sources Object</a> for this package.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Deployment Bytecode: `deploymentBytecode`
|
|||
|
|
|||
|
The `deploymentBytecode` field defines the bytecode for this [Contract
|
|||
|
Type](#term-contract-type).
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Object</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p><strong>Must</strong> conform to <a href="#bytecode-object">the Bytecode object</a> format.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Runtime Bytecode: `runtimeBytecode`
|
|||
|
|
|||
|
The `runtimeBytecode` field defines the unlinked `0x`-prefixed runtime
|
|||
|
portion of [Bytecode](#term-bytecode) for this [Contract
|
|||
|
Type](#term-contract-type).
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Object</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p><strong>Must</strong> conform to <a href="#bytecode-object">the Bytecode object</a> format.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### ABI: `abi`
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Array</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p><strong>Must</strong> conform to <a href="https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#json">Ethereum Contract ABI JSON</a> format.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### UserDoc: `userdoc`
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Object</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p><strong>Must</strong> conform to <a href="https://github.com/ethereum/wiki/wiki/Ethereum-Natural-Specification-Format#user-documentation">UserDoc</a> format.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### DevDoc: `devdoc`
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Object</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p><strong>Must</strong> conform to <a href="https://github.com/ethereum/wiki/wiki/Ethereum-Natural-Specification-Format#developer-documentation">DevDoc</a> format.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
<div id="contract-instance-object"></div>
|
|||
|
|
|||
|
### The *Contract Instance* Object
|
|||
|
|
|||
|
A **Contract Instance Object** represents a single deployed [Contract
|
|||
|
Instance](#term-contract-instance) and is defined to have the following
|
|||
|
key/value pairs.
|
|||
|
|
|||
|
#### Contract Type: `contractType`
|
|||
|
|
|||
|
The `contractType` field defines the [Contract
|
|||
|
Type](#term-contract-type) for this [Contract
|
|||
|
Instance](#term-contract-instance). This can reference any of the
|
|||
|
contract types included in this [Package](#term-package) *or* any of the
|
|||
|
contract types found in any of the package dependencies from the
|
|||
|
`buildDependencies` section of the [Package
|
|||
|
Manifest](#term-package-manifest).
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p>See Below.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
Format
|
|||
|
|
|||
|
Values for this field **must** conform to *one of* the two formats
|
|||
|
herein.
|
|||
|
|
|||
|
To reference a contract type from this Package, use the format
|
|||
|
`<contract-alias>`.
|
|||
|
|
|||
|
- The `<contract-alias>` value **must** be a valid [Contract
|
|||
|
Alias](#term-contract-alias).
|
|||
|
|
|||
|
- The value **must** be present in the keys of the `contractTypes`
|
|||
|
section of this Package.
|
|||
|
|
|||
|
To reference a contract type from a dependency, use the format
|
|||
|
`<package-name>:<contract-alias>`.
|
|||
|
|
|||
|
- The `<package-name>` value **must** be present in the keys of the
|
|||
|
`buildDependencies` of this Package.
|
|||
|
|
|||
|
- The `<contract-alias>` value **must** be be a valid [Contract
|
|||
|
Alias](#term-contract-alias).
|
|||
|
|
|||
|
- The resolved package for `<package-name>` must contain the
|
|||
|
`<contract-alias>` value in the keys of the `contractTypes` section.
|
|||
|
|
|||
|
#### Address: `address`
|
|||
|
|
|||
|
The `address` field defines the [Address](#term-address) of the
|
|||
|
[Contract Instance](#term-contract-instance).
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p>Hex encoded <code>0x</code> prefixed Ethereum address matching the regular expression <code>^0x[0-9a-fA-F]{40}$</code>.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Transaction: `transaction`
|
|||
|
|
|||
|
The `transaction` field defines the transaction hash in which this
|
|||
|
[Contract Instance](#term-contract-instance) was created.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p><code>0x</code> prefixed hex encoded transaction hash.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Block: `block`
|
|||
|
|
|||
|
The `block` field defines the block hash in which this the transaction
|
|||
|
which created this *contract instance* was mined.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p><code>0x</code> prefixed hex encoded block hash.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Runtime Bytecode: `runtimeBytecode`
|
|||
|
|
|||
|
The `runtimeBytecode` field defines the runtime portion of bytecode for
|
|||
|
this [Contract Instance](#term-contract-instance). When present, the
|
|||
|
value from this field supersedes the `runtimeBytecode` from the
|
|||
|
[Contract Type](#term-contract-type) for this [Contract
|
|||
|
Instance](#term-contract-instance).
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Object</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Format</p></td>
|
|||
|
<td><p><strong>Must</strong> conform to <a href="#bytecode-object">the Bytecode Object</a> format.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
Every entry in the `linkReferences` for this bytecode **must** have a
|
|||
|
corresponding entry in the `linkDependencies` section.
|
|||
|
|
|||
|
|
|||
|
<div id="compiler-information-object"></div>
|
|||
|
|
|||
|
### The *Compiler Information* Object
|
|||
|
|
|||
|
The `compilers` field defines the various compilers and settings used
|
|||
|
during compilation of any [Contract Types](#term-contract-type) or
|
|||
|
[Contract Instance](#term-contract-instance) included in this package.
|
|||
|
|
|||
|
A *Compiler Information* object is defined to have the following
|
|||
|
key/value pairs.
|
|||
|
|
|||
|
#### Name: `name`
|
|||
|
|
|||
|
The `name` field defines which compiler was used in compilation.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>name</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Version: `version`
|
|||
|
|
|||
|
The `version` field defines the version of the compiler. The field
|
|||
|
**should** be OS agnostic (OS not included in the string) and take the
|
|||
|
form of either the stable version in
|
|||
|
[semver](http://semver.org/) format or if built on a
|
|||
|
nightly should be denoted in the form of `<semver>-<commit-hash>` ex:
|
|||
|
`0.4.8-commit.60cc1668`.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>Yes</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>version</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>String</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Settings: `settings`
|
|||
|
|
|||
|
The `settings` field defines any settings or configuration that was used
|
|||
|
in compilation. For the `"solc"` compiler, this **should** conform to
|
|||
|
the [Compiler Input and Output
|
|||
|
Description](http://solidity.readthedocs.io/en/latest/using-the-compiler.html#compiler-input-and-output-json-description).
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>settings</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Object</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
#### Contract Types: `contractTypes`
|
|||
|
|
|||
|
A list of the [Contract Alias](#term-contract-alias) or [Contract Types](#term-contract-type) in this package
|
|||
|
that used this compiler to generate its outputs.
|
|||
|
|
|||
|
- All `contractTypes` that locally declare `runtimeBytecode`
|
|||
|
**should** be attributed for by a compiler object.
|
|||
|
|
|||
|
- A single `contractTypes` **must** not be attributed to more than one
|
|||
|
compiler.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Required</p></td>
|
|||
|
<td><p>No</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Key</p></td>
|
|||
|
<td><p><code>contractTypes</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Type</p></td>
|
|||
|
<td><p>Array(<a href="#term-contract-alias">Contract Alias</a>)</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
<div id="bip122"></div>
|
|||
|
|
|||
|
### BIP122 URIs
|
|||
|
|
|||
|
BIP122 URIs are used to define a blockchain via a subset of the
|
|||
|
[BIP-122](https://github.com/bitcoin/bips/blob/master/bip-0122.mediawiki)
|
|||
|
spec.
|
|||
|
|
|||
|
blockchain://<genesis_hash>/block/<latest confirmed block hash>
|
|||
|
|
|||
|
The `<genesis hash>` represents the blockhash of the first block on the
|
|||
|
chain, and `<latest confirmed block hash>` represents the hash of the
|
|||
|
latest block that’s been reliably confirmed (package managers should be
|
|||
|
free to choose their desired level of confirmations).
|
|||
|
|
|||
|
### Glossary
|
|||
|
|
|||
|
The terms in this glossary have been updated to reflect the changes made
|
|||
|
in V3.
|
|||
|
|
|||
|
<div id="term-abi"></div>
|
|||
|
ABI
|
|||
|
The JSON representation of the application binary interface. See the
|
|||
|
official
|
|||
|
[specification](https://solidity.readthedocs.io/en/develop/abi-spec.html)
|
|||
|
for more information.
|
|||
|
|
|||
|
<div id="term-address"></div>
|
|||
|
Address
|
|||
|
A public identifier for an account on a particular chain
|
|||
|
|
|||
|
<div id="term-bytecode"></div>
|
|||
|
Bytecode
|
|||
|
The set of EVM instructions as produced by a compiler. Unless otherwise
|
|||
|
specified this should be assumed to be hexadecimal encoded, representing
|
|||
|
a whole number of bytes, and [prefixed](#term-prefixed) with `0x`.
|
|||
|
|
|||
|
Bytecode can either be linked or unlinked. (see
|
|||
|
[Linking](#term-linking))
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Unlinked Bytecode</p></td>
|
|||
|
<td><p>The hexadecimal representation of a contract’s EVM instructions that contains sections of code that requires <a href="#term-linking">linking</a> for the contract to be functional.</p>
|
|||
|
<p>The sections of code which are unlinked <strong>must</strong> be filled in with zero bytes.</p>
|
|||
|
<p><strong>Example</strong>: <code>0x606060405260e06000730000000000000000000000000000000000000000634d536f</code></p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>Linked Bytecode</p></td>
|
|||
|
<td><p>The hexadecimal representation of a contract’s EVM instructions which has had all <a href="#term-link-reference">Link References</a> replaced with the desired <a href="#term-link-value">Link Values</a>.</p>
|
|||
|
<p><strong>Example</strong>: <code>0x606060405260e06000736fe36000604051602001526040518160e060020a634d536f</code></p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
<div id="term-chain-definition"></div>
|
|||
|
Chain Definition
|
|||
|
This definition originates from [BIP122
|
|||
|
URI](https://github.com/bitcoin/bips/blob/master/bip-0122.mediawiki).
|
|||
|
|
|||
|
A URI in the format `blockchain://<chain_id>/block/<block_hash>`
|
|||
|
|
|||
|
- `chain_id` is the unprefixed hexadecimal representation of the
|
|||
|
genesis hash for the chain.
|
|||
|
|
|||
|
- `block_hash` is the unprefixed hexadecimal representation of the
|
|||
|
hash of a block on the chain.
|
|||
|
|
|||
|
A chain is considered to match a chain definition if the the genesis
|
|||
|
block hash matches the `chain_id` and the block defined by `block_hash`
|
|||
|
can be found on that chain. It is possible for multiple chains to match
|
|||
|
a single URI, in which case all chains are considered valid matches
|
|||
|
|
|||
|
<div id="term-content-addressable-uri"></div>
|
|||
|
Content Addressable URI
|
|||
|
Any URI which contains a cryptographic hash which can be used to verify
|
|||
|
the integrity of the content found at the URI.
|
|||
|
|
|||
|
The URI format is defined in RFC3986
|
|||
|
|
|||
|
It is **recommended** that tools support IPFS and Swarm.
|
|||
|
|
|||
|
<div id="term-contract-alias"></div>
|
|||
|
Contract Alias
|
|||
|
This is a name used to reference a specific [Contract
|
|||
|
Type](#term-contract-type). Contract aliases **must** be unique within a
|
|||
|
single [Package](#term-package).
|
|||
|
|
|||
|
The contract alias **must** use *one of* the following naming schemes:
|
|||
|
|
|||
|
- `<contract-name>`
|
|||
|
|
|||
|
- `<contract-name><identifier>`
|
|||
|
|
|||
|
The `<contract-name>` portion **must** be the same as the [Contract
|
|||
|
Name](#term-contract-name) for this contract type.
|
|||
|
|
|||
|
The `<identifier>` portion **must** match the regular expression
|
|||
|
`^[-a-zA-Z0-9]{1,256}$`.
|
|||
|
|
|||
|
<div id="term-contract-instance"></div>
|
|||
|
Contract Instance
|
|||
|
A contract instance a specific deployed version of a [Contract
|
|||
|
Type](#term-contract-type).
|
|||
|
|
|||
|
All contract instances have an [Address](#term-address) on some specific
|
|||
|
chain.
|
|||
|
|
|||
|
<div id="term-contract-instance-name"></div>
|
|||
|
Contract Instance Name
|
|||
|
A name which refers to a specific [Contract
|
|||
|
Instance](#term-contract-instance) on a specific chain from the
|
|||
|
deployments of a single [Package](#term-package). This name **must** be
|
|||
|
unique across all other contract instances for the given chain. The name
|
|||
|
must conform to the regular expression
|
|||
|
`^[a-zA-Z_$][a-zA-Z0-9_$]{0,255}$`
|
|||
|
|
|||
|
In cases where there is a single deployed instance of a given [Contract
|
|||
|
Type](#term-contract-type), package managers **should** use the
|
|||
|
[Contract Alias](#term-contract-alias) for that contract type for this
|
|||
|
name.
|
|||
|
|
|||
|
In cases where there are multiple deployed instances of a given contract
|
|||
|
type, package managers **should** use a name which provides some added
|
|||
|
semantic information as to help differentiate the two deployed instances
|
|||
|
in a meaningful way.
|
|||
|
|
|||
|
<div id="term-contract-name"></div>
|
|||
|
Contract Name
|
|||
|
The name found in the source code that defines a specific [Contract
|
|||
|
Type](#term-contract-type). These names **must** conform to the regular
|
|||
|
expression `^[a-zA-Z_$][a-zA-Z0-9_$]{0,255}$`.
|
|||
|
|
|||
|
There can be multiple contracts with the same contract name in a
|
|||
|
projects source files.
|
|||
|
|
|||
|
<div id="term-contract-type"></div>
|
|||
|
Contract Type
|
|||
|
Refers to a specific contract in the package source. This term can be
|
|||
|
used to refer to an abstract contract, a normal contract, or a library.
|
|||
|
Two contracts are of the same contract type if they have the same
|
|||
|
bytecode.
|
|||
|
|
|||
|
Example:
|
|||
|
|
|||
|
contract Wallet {
|
|||
|
...
|
|||
|
}
|
|||
|
|
|||
|
A deployed instance of the `Wallet` contract would be of of type
|
|||
|
`Wallet`.
|
|||
|
|
|||
|
<div id="term-identifier"></div>
|
|||
|
Identifier
|
|||
|
Refers generally to a named entity in the [Package](#term-package).
|
|||
|
|
|||
|
A string matching the regular expression
|
|||
|
`^[a-zA-Z][-_a-zA-Z0-9]{0,255}$`
|
|||
|
|
|||
|
<div id="term-link-reference"></div>
|
|||
|
Link Reference
|
|||
|
A location within a contract’s bytecode which needs to be linked. A link
|
|||
|
reference has the following properties.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p><code>offset</code></p></td>
|
|||
|
<td><p>Defines the location within the bytecode where the link reference begins.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p><code>length</code></p></td>
|
|||
|
<td><p>Defines the length of the reference.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p><code>name</code></p></td>
|
|||
|
<td><p>(optional) A string to identify the reference</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
<div id="term-link-value"></div>
|
|||
|
Link Value
|
|||
|
A link value is the value which can be inserted in place of a [Link
|
|||
|
Reference](#term-link-reference)
|
|||
|
|
|||
|
<div id="term-linking"></div>
|
|||
|
Linking
|
|||
|
The act of replacing [Link References](#term-link-reference) with [Link
|
|||
|
Values](#term-link-value) within some [Bytecode](#term-bytecode).
|
|||
|
|
|||
|
<div id="term-package"></div>
|
|||
|
Package
|
|||
|
Distribution of an application’s source or compiled bytecode along with
|
|||
|
metadata related to authorship, license, versioning, et al.
|
|||
|
|
|||
|
For brevity, the term **Package** is often used metonymously to mean
|
|||
|
[Package Manifest](#term-package-manifest).
|
|||
|
|
|||
|
<div id="term-package-manifest"></div>
|
|||
|
Package Manifest
|
|||
|
A machine-readable description of a package.
|
|||
|
|
|||
|
<div id="term-prefixed"></div>
|
|||
|
Prefixed
|
|||
|
[Bytecode](#term-bytecode) string with leading `0x`.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Example</p></td>
|
|||
|
<td><p><code>0xdeadbeef</code></p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
<div id="term-unprefixed"></div>
|
|||
|
Unprefixed
|
|||
|
Not [Prefixed](#term-prefixed).
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 50%" />
|
|||
|
<col style="width: 50%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>Example</p></td>
|
|||
|
<td><p><code>deadbeef</code></p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
|
|||
|
|
|||
|
## Rationale
|
|||
|
|
|||
|
The following use cases were considered during the creation of this
|
|||
|
specification.
|
|||
|
|
|||
|
<table>
|
|||
|
<colgroup>
|
|||
|
<col style="width: 30%" />
|
|||
|
<col style="width: 70%" />
|
|||
|
</colgroup>
|
|||
|
<tbody>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>owned</p></td>
|
|||
|
<td><p>A package which contains contracts which are not meant to be used by themselves but rather as base contracts to provide functionality to other contracts through inheritance.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>transferable</p></td>
|
|||
|
<td><p>A package which has a single dependency.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>standard-token</p></td>
|
|||
|
<td><p>A package which contains a reusable contract.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>safe-math-lib</p></td>
|
|||
|
<td><p>A package which contains deployed instance of one of the package contracts.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>piper-coin</p></td>
|
|||
|
<td><p>A package which contains a deployed instance of a reusable contract from a dependency.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>escrow</p></td>
|
|||
|
<td><p>A package which contains a deployed instance of a local contract which is linked against a deployed instance of a local library.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="even">
|
|||
|
<td><p>wallet</p></td>
|
|||
|
<td><p>A package with a deployed instance of a local contract which is linked against a deployed instance of a library from a dependency.</p></td>
|
|||
|
</tr>
|
|||
|
<tr class="odd">
|
|||
|
<td><p>wallet-with-send</p></td>
|
|||
|
<td><p>A package with a deployed instance which links against a deep dependency.</p></td>
|
|||
|
</tr>
|
|||
|
</tbody>
|
|||
|
<tr class="even">
|
|||
|
<td><p>simple-auction</p></td>
|
|||
|
<td><p>Compiler <code>"metadata"</code> field output.</p></td>
|
|||
|
</tr>
|
|||
|
</table>
|
|||
|
|
|||
|
Each use case builds incrementally on the previous one.
|
|||
|
|
|||
|
A full listing of [Use
|
|||
|
Cases](https://ethpm.github.io/ethpm-spec/use-cases.html)
|
|||
|
can be found on the hosted version of this specification.
|
|||
|
|
|||
|
## Backwards Compatibility
|
|||
|
|
|||
|
To improve understanding and readability of the EthPM spec, the
|
|||
|
`manifest_version` field was updated to `manifest` in v3. To ensure
|
|||
|
backwards compatibility, v3 packages **must** define a top-level
|
|||
|
`"manifest"` with a value of `"ethpm/3"`. Additionally,
|
|||
|
`"manifest_version"` is a forbidden top-level key in v3 packages.
|
|||
|
|
|||
|
|
|||
|
## Implementations
|
|||
|
|
|||
|
This submission aims to coincide with development efforts towards
|
|||
|
widespread implementation in commonly-used development tools.
|
|||
|
|
|||
|
The following tools are known to have begun or are nearing completion of
|
|||
|
a supporting implementation.
|
|||
|
|
|||
|
- [Truffle](https://trufflesuite.com/)
|
|||
|
|
|||
|
- [Brownie](https://eth-brownie.readthedocs.io/en/stable/)
|
|||
|
|
|||
|
- [web3.py](https://github.com/ethereum/web3.py/)
|
|||
|
|
|||
|
- [ethpm-cli](https://github.com/ethpm/ethpm-cli)
|
|||
|
|
|||
|
Full support in implementation **may** require [Further
|
|||
|
Work](#further-work), specified below.
|
|||
|
|
|||
|
|
|||
|
## Further Work
|
|||
|
|
|||
|
This EIP addresses only the data format for package descriptions.
|
|||
|
Excluded from the scope of this specification are:
|
|||
|
|
|||
|
- Package registry interface definition [ERC 1319](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1319.md)
|
|||
|
|
|||
|
- Tooling integration, or how packages are stored on disk.
|
|||
|
|
|||
|
These efforts **should** be considered separate, warranting future
|
|||
|
dependent EIP submssions.
|
|||
|
|
|||
|
|
|||
|
## Acknowledgements
|
|||
|
|
|||
|
The authors of this document would like to thank the original authors of
|
|||
|
[EIP-190](https://eips.ethereum.org/EIPS/eip-190),
|
|||
|
[EIP-1123](https://eips.ethereum.org/EIPS/eip-1123), all community
|
|||
|
[contributors](https://github.com/ethpm/ethpm-spec/graphs/contributors),
|
|||
|
and the Ethereum community at large.
|
|||
|
|
|||
|
|
|||
|
## Security Considerations
|
|||
|
|
|||
|
The same security considerations from v2 are still relevant for EthPM v3. Using EthPM packages implicitly requires
|
|||
|
that users import &/or execute code written by others. The EthPM spec guarantees that when using a properly
|
|||
|
constructed and released EthPM package, the user will have the exact same code that was included in the package
|
|||
|
by the package author. However, it is impossible to guarantee that this code is safe to interact with. Therefore,
|
|||
|
it is critical that end users only interact with EthPM packages authored and released by individuals or organizations
|
|||
|
that they trust to include non-malicious code.
|
|||
|
|
|||
|
## Copyright
|
|||
|
|
|||
|
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
|