MetaFile

MetaFile is a representation of the metafile.json file.

Store and retrieve metdata about a contract for this project

Example JSON structure:

{
  "contracts": [
    {
      "name": "ExampleContract",
      "networks": {
        "1": {
          "deployedHash": "0xdeadbeef...",
          "deployedInstances": [
            {
              "hash": "0xdeadbeef...",
              "date": "2018-10-21 00:00:00T-7",
              "address": "0xdeadbeef...",
            }
          ]
        }
      }
    }
  ],
  "seenAccounts": [
    "0xdeadbeef..."
  ],
  "defaultAccount": "0xdeadbeef..."
}
class solidbyte.common.metafile.MetaFile(filename_override: Union[pathlib.Path, str] = None, project_dir: Union[pathlib.Path, str] = None, read_only: bool = False)[source]

Class representing the project metafile

__init__(filename_override: Union[pathlib.Path, str] = None, project_dir: Union[pathlib.Path, str] = None, read_only: bool = False) → None[source]

Initialize self. See help(type(self)) for accurate signature.

account_known(address: str) → bool[source]

Check if an account is known

add_account(address: str) → None[source]

Add an account to seenAccounts

backup(outfile) → bool[source]

Backup the metafile.json and verify

cleanup(dry_run: bool = False) → List[Tuple[str, str, str]][source]

Cleanup metafile.json of test deployments. In practice, this means any deployments with a network_id > 100, as the last semi-official network_id is 99.

Returns a list of tuple. Tuples are (name, network_id).

get_all_contracts() → List[attrdict.dictionary.AttrDict][source]

return all meta data for all contracts

get_contract(name) → attrdict.dictionary.AttrDict[source]

Get the meta data for a contract

get_default_account() → Optional[str][source]

Get the default account

set_default_account(address) → None[source]

Set the default account

solidbyte.common.metafile.autoload(f: Callable) → Callable[source]

MetaFile method decorator to automatically load the metafile before method execution

solidbyte.common.metafile.autosave(f: Callable) → Callable[source]

MetaFile method decorator to automatically save the metafile after method execution