UNPKG

2.35 kBMarkdownView Raw
1# truffle-contract-schema
2JSON schema for contract artifacts
3
4# Schema
5
6The schema, which includes a JSON schema validator, needs to be created and fleshed out with strict documentation. However, in light of that effort, a loose schema is defined below:
7
8```
9{
10 "contract_name": ...,
11 "abi": ...,
12 "unlinked_binary": ...,
13 "network_id": ...,
14 "address": ...,
15 "links": ...,
16 "events": ...,
17 "default_network": ...,
18 "networks": ...
19}
20```
21
22* `contract_name`: `string`, optional: Name of the contract that will be used to identify this contract. Defaults to `Contract`.
23* `abi`: `array`, required; array returned by the Solidity compiler after compilation of a Solidity source file.
24* `unlinked_binary`: `string`, required: hexadecimal bytecode string of a Solidity contract returned by the Solidity compiler, without libraries linked.
25* `network_id`: `string` or `number`, optional: A string or number that represents the id of the network these contract artifacts apply to. If none specified, will default to `"*"`, which signifies these artifacts apply to the "wildcard network", which is useful in some circumstances.
26* `address`: `string`, optional; the default address associated with this contract on the network specified by `network_id`.
27* `links`: `object`, optional: A set of key/value pairs that link contract names that exist within the `unlinked_binary` to their specified addresses on the network specified by network_id.
28* `events`: `object`, optional: Log topic/event abi pairs that represent logs that can be thrown. This object may describe logs and events that exist outside of the current contract so that this object will be able to parse those events correctly.
29* `default_network`: `string` or `number`: The default network to be used when this object is instantiated via [truffle-contract](https://github.com/trufflesuite/truffle-contract).
30* `networks: `object`, optional: key/value pairs of network ids and their associated network objects. Each network object may contain the `address`, `links` and `events` objects described above, containing data that's specific to addresses on each network.
31
32
33# Testing
34
35This package is the result of breaking up EtherPudding into multiple modules. Tests currently reside within [truffle-artifactor](https://github.com/trufflesuite/truffle-artifactor) but will soon move here.