Giter Club home page Giter Club logo

ethereum-erc190's Introduction

ETHPM

  • parse and validate lockfiles.
  • given a web3 instance provide access to contract factory classes
  • given 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 output
  • access to packages dependencies
  • construct new lockfiles

Web3

The Package object will function much like the Contract class provided by web3. Rather than instantiating the base class provided by ethpm, you will instead use a classmethod which generates a new Package class for a given lockfile.

OwnedPackage = BasePackage.factory('/path/to/owned-v1.0.0.json')

Then, the OwnedPackage can be instantiated with any web3 intance.

owned_package = OwnedPackage(web3)

Package classes should be constructable from any of:

  • Local filesystem path to a lockfile
  • Lockfile URI
  • The parsed lockfile JSON

Contract Factories

Contract 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.owned

In cases where a contract uses a library, the contract factory will have unlinked bytecode. The ethpm package ships with its own subclass of web3.contract.Contract with a few extra methods and properties related to bytecode linking

>>> math = owned_package.contract_factories.math
>>> math.has_linkable_bytecode
True
>>> math.is_bytecode_linked
False
>>> linked_math = math.link_bytecode({'MathLib': '0x1234...'})
>>> linked_math.is_bytecode_linked
True

Note: 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 Contracts

Deployed contracts are only available from package instances. The package instance will filter the deployments based on the chain that web3 is connected to.

Accessing deployments is done with property access

package.deployed_contracts.Greeter

IPFS

We'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 Things

The Package class should verify all of the following things.

  • Lockfile matches json schema.
  • Included bytecode matches compilation output
  • Deployed bytecode matches compilation output

Dependencies

The Package class should provide access to the full dependency tree.

>>> owned_package.build_dependencies['zeppelin']
<ZeppelinPackage>

Testing Strategy

  • Load and validate lockfiles from disk.
  • Access lockfile data.
  • Access contract factories.

ethereum-erc190's People

Contributors

ethanbennett avatar njgheorghita avatar pipermerriam avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.