0.0.2 • Published 1 year ago

nvm-contracts-test v0.0.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

banner

Nevermined Smart Contracts

💧 Smart Contracts implementation of Nevermined in Solidity nevermined.io

Docker Build Status Build Pypi Package

Table of Contents


Get Started

For local development of nevermined-contracts you can either use Docker, or setup the development environment on your machine.

Docker

The simplest way to get started with is using the Nevermined Tools, a docker compose application to run all the Nevermined stack.

Public Network development

For deploying in a public network check ReleaseProcess.md first.

Local development

As a pre-requisite, you need:

  • Node.js
  • yarn

Clone the project and install all dependencies:

git clone git@github.com:nevermined-io/contracts.git
cd nevermined-contracts/

Install dependencies:

yarn

Compile the solidity contracts:

yarn compile

In a new terminal, launch an Ethereum RPC client, e.g. hardhat:

npx hardhat node --port 18545

Switch back to your other terminal and deploy the contracts:

yarn deploy:external

For redeployment run this instead

yarn clean
yarn compile
yarn deploy:external

Upgrade contracts optional:

yarn upgrade:external

Testing

Run tests with yarn test, e.g.:

yarn test test/unit/agreements/AgreementStoreManager.Test.js

Code Linting

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

Code style is enforced through the CI test process, builds will fail if there're any linting errors.

yarn lint

Networks

When Nevermined contracts are deployed into different networks, the ABIs referring to the specific version deployed are copied into the Artifacts repository. You can find more information about the this into the Release Process documentation.

You can browse the different artifacts deployed here: http://artifacts-nevermined-rocks.s3-website-us-east-1.amazonaws.com/ Also you can find a complete list here: https://artifacts.nevermined.rocks/

Packages

To facilitate the integration of nevermined-contracts there are Python, JavaScript packages ready to be integrated. Those libraries include the Smart Contract ABI's. Using these packages helps to avoid compiling the Smart Contracts and copying the ABI's manually to your project. In that way the integration is cleaner and easier. The packages provided currently are:

The packages contains all the content from the doc/ and artifacts/ folders.

In JavaScript they can be used like this:

Install the nevermined-contracts npm package.

npm install @nevermined-io/contracts

Load the ABI of the NeverminedToken contract on the Rinkeby network:

const NeverminedToken = require('@nevermined-io/contracts/artifacts/NeverminedToken.rinkeby.json')

The structure of the artifacts is:

{
  "abi": "...",
  "bytecode": "0x60806040523...",
  "address": "0x45DE141F8Efc355F1451a102FB6225F1EDd2921d",
  "version": "v0.9.1"
}

Documentation

Prior Art

This project builds on top of the work done in open source projects:

Attribution

This project is based in the Ocean Protocol Keeper Contracts. It keeps the same Apache v2 License and adds some improvements. See NOTICE file.

License

Copyright 2022 Nevermined AG
This product includes software developed at
BigchainDB GmbH and Ocean Protocol (https://www.oceanprotocol.com/)

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.