🐳 Ocean Protocol L1 - v3
Project description
Ocean Protocol Contracts
This is in alpha state and you can expect running into problems. If you run into them, please open up a new issue.
Table of Contents
Get Started
Installation
For quick installation of the contracts ABIs
:
npm i @oceanprotocol/contracts
Usage
To import a contract ABI:
const dtFactoryABI = require('@oceanprotocol/contracts/artifacts/development/DTFactory.json')
const dtFactoryAddress = '0x123456789.....'
const dtFactory = new web3.eth.Contract(
dtFactoryABI,
dtFactoryAddress,
{
from: accounts[0]
}
)
// create new datatoken
const tx = await dtFactory.methods
.createToken('https://123example.com')
.send()
let tokenAddress = null
try {
tokenAddress = tx.events.TokenCreated.returnValue[0]
} catch (e) {
console.error(e)
}
Local development
For local development of the contracts
setup the development environment on your machine as follows:
As a pre-requisite, you need:
- Node.js
- npm
Note: For MacOS, make sure to have node@10
installed.
Clone the project and install all dependencies:
git clone git@github.com:oceanprotocol/contracts.git
cd contracts/
# install packages
npm i
# to compile contracts
npm run compile
Testing
Run tests with
# for unit tests
npm run test:unit
# for test coverage
npm run test:cover
Code Linting
Linting is setup for JavaScript
with ESLint & Solidity with Ethlint.
# to check lint issues
npm run lint
Code style is enforced through the CI test process, builds will fail if there're any linting errors.
Networks
Testnets
For local development, start a local testnet using ganache-cli
, then run:
npm run deploy
Checkout the supported deployment(s) on test networks.
Documentation
To use generate documentation via solidity-docgen
please run:
npm run doc:generate
Contributing
See the page titled "Ways to Contribute" in the Ocean Protocol documentation.
Prior Art
This project builds on top of the work done in open source projects:
License
Copyright 2018 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ocean_contracts-0.3.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb57ed1b49c6d12103697525dd8724db725297bcc34db5218472afc9778d1a1e |
|
MD5 | 39ed8db5ceaad413c4dbdbd00ea098cd |
|
BLAKE2b-256 | c947add681d8eff31a20fa7fd9afa9445a5e4e804e85ce2759008cf896126b78 |