Giter Site home page Giter Site logo

mancioshell / contracts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oceanprotocol/contracts

0.0 1.0 0.0 98.58 MB

๐Ÿ™ Smart contracts for Ocean Protocol v3

Home Page: https://oceanprotocol.com

License: Apache License 2.0

Solidity 55.63% JavaScript 42.34% Shell 1.09% Python 0.71% Dockerfile 0.23%

contracts's Introduction

banner

Ocean Contracts

๐Ÿ™ Smart contracts for Ocean Protocol v3. https://oceanprotocol.com

Build Status codecov

Overview:

image

Table of Contents

๐Ÿ— Installation

For quick installation of the contract ABIs:

Javascript/Typescript

yarn add @oceanprotocol/contracts

Python

pip3 install ocean-contracts

โš™๏ธ Usage

By default, Python does not support importing json files directly, so it is recommended to use json-sempai package in order to automatically importing ABIs/json artifacts.

pip3 install json-sempai
# install the ocean-contracts package.
from jsonsempai import magic
from artifacts import address
address.mainnet
{'DTFactory': '0x57317f97E9EA49eBd19f7c9bB7c180b8cDcbDeB9', 'BFactory': '0xbe0083053744ECb871510C88dC0f6b77Da162706', 'FixedRateExchange': '0x608d05214E42722B94a54cF6114d4840FCfF84e1', 'Metadata': '0x1a4b70d8c9DcA47cD6D0Fb3c52BB8634CA1C0Fdf', 'Ocean': '0x967da4048cD07aB37855c090aAF366e4ce1b9F48'}

๐Ÿ„ Quickstart

The ocean.js and ocean.py libraries wrap contracts in JavaScript and Python respectively. They each have quickstart guides.

๐Ÿ›ณ Network Deployments

You can use an existing deployment of Ocean contracts, deploy locally, or deploy to a remote network. Let's review each.

Use existing deployments

Ocean contracts are deployed to Rinkeby, Ethereum mainnet, and more. Here are details.

Deploy Locally (Ganache)

  • In a separate terminal, start the testnet: ganache-cli
  • In your main terminal, run: yarn deploy
  • Confirm: are "development" entries updated in addresses file ./artifacts/address.json?

Deploy to Remote (e.g. Rinkeby)

  • In your main terminal:
export MNEMONIC='YOUR MNEMONIC SHOULD BE HERE'

# If you are using remote test or Etherejm mainnet using Infura
export INFURA_TOKEN='GET INFURA_TOKEN FROM INFURA PLATFORM'

yarn deploy:rinkeby
  • Confirm: are "rinkeby" entries updated in addresses file ./artifacts/address.json?

๐Ÿฆ‘ Local Development

For local development of contracts, set up the development environment on your machine as follows.

As a prerequisite, you need:

  • Node.js v12+
  • yarn

Clone the project and install all dependencies:

git clone [email protected]:oceanprotocol/contracts.git
cd contracts/

# install packages
yarn

# to compile contracts
yarn compile

โœจ Code Style

Linting is setup for JavaScript with ESLint & Solidity with Ethlint.

# to check lint issues
yarn lint

๐Ÿ‘ฉโ€๐Ÿ”ฌ Testing

In a separate console:

ganache-cli

In main console:

# for unit tests
yarn test:unit

# for test coverage
yarn test:cover

Code style is enforced through the CI test process. Builds will fail if there are linting errors.

โฌ†๏ธ Releases

Submit contributions with this workflow.

Finally, do a release using this process.

๐Ÿ› License

Copyright 2021 Ocean Protocol Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

contracts's People

Contributors

0x3bfc avatar alexcos20 avatar arseneeth avatar trentmc avatar dependabot-preview[bot] avatar ssallam avatar kremalicious avatar dependabot[bot] avatar mantisclone avatar timdaub avatar

Watchers

James Cloos 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.