Package: eth-pm
parse and validate packagesgiven a web3 instance provide access to contract factory classesgiven a web3 instance provide access to all of the deployed contract
instances for the chain that web3 is connected to.validate package bytecode matches compilation output.validate deployed bytecode matches compilation outputaccess to packages dependenciesconstruct new packagesWeb3ThePackageobject will function much like theContractclass
provided byweb3. Rather than instantiating the base class provided
byethpm, you will instead use aclassmethodwhich generates a
newPackageclass for a given package.OwnedPackage=BasePackage.factory('/path/to/owned-v1.0.0.json')Then, theOwnedPackagecan be instantiated with anyweb3intance.owned_package=OwnedPackage(web3)APackageclass can only be directly constructed from the parsed
package JSON. It can also be initialized with the package’s URI or the
local filesystem path to a package by usingPackage.from_file(path).Contract FactoriesContract factories should be accessible from the package class but you
must also provide a web3 instance.Owned=OwnedPackage.get_contract_factory(web3,'owned')From a package instance, they are also available as properties.Owned=owned_package.contract_factories.ownedIn cases where a contract uses a library, the contract factory will have
unlinked bytecode. Theethpmpackage ships with its own subclass ofweb3.contract.Contractwith a few extra methods and properties
related to bytecode linking>>>math=owned_package.contract_factories.math>>>math.has_linkable_bytecodeTrue>>>math.is_bytecode_linkedFalse>>>linked_math=math.link_bytecode({'MathLib':'0x1234...'})>>>linked_math.is_bytecode_linkedTrueNote: the actual format of the link data is not clear since library
names aren’t a one-size-fits all solution. We need the ability to
specify specific link references in the code.Deployed ContractsDeployed contracts are only available from package instances. The
package instance will filter thedeploymentsbased on the chain thatweb3is connected to.Accessing deployments is done with property accesspackage.deployed_contracts.GreeterIPFSWe’ll need a pluggable backend system for IPFS access. A built-in
default one that defaults to using infura should be enough to get off
the ground.Lower priority but important will be ensuring that a user can configure
connecting to their own IPFS node.Verifying ThingsThePackageclass should verify all of the following things.Package json matches EthPM V2 Manifest SpecificationIncluded bytecode matches compilation outputDeployed bytecode matches compilation outputDependenciesThePackageclass should provide access to the full dependency tree.>>>owned_package.build_dependencies['zeppelin']<ZeppelinPackage>Testing StrategyLoad and validate packages from disk.Access package data.Access contract factories.EthPM-SpecEthPM-Specis referenced
inside this repo as a submodule.**If you clone this repository, you should run this command to fetch
the contents of the submodulegitsubmoduleinitRegistry URIThe URI to lookup a package from a registry should follow the following
format. (subject to change as the Registry Contract Standard makes it’s
way through the EIP process)scheme://authority/package-name?version=x.x.xURI must be a string typescheme:ercxxxauthority: Must be a valid ENS domain or a valid checksum address
pointing towards a registry contract.package-name: Must conform to the package-name as specified in
theEthPM-Spec.version: The URI escaped version string,shouldconform to thesemverversion numbering specification.i.e.ercxxx://packages.zeppelinos.eth/owned?version=1.0.0Release setupFor Debian-like systems:aptinstallpandocTo release a new version:makereleasebump=$$VERSION_PART_TO_BUMP$$How to bumpversionThe version format for this repo is{major}.{minor}.{patch}for
stable, and{major}.{minor}.{patch}-{stage}.{devnum}for unstable
(stagecan be alpha or beta).To issue the next version in line, specify which part to bump, likemake release bump=minorormake release bump=devnum.If you are in a beta version,make release bump=stagewill switch to
a stable.To issue an unstable version when the current version is stable, specify
the new version explicitly, likemake releasebump="--new-version4.0.0-alpha.1devnum"