Skip to content

nspcc-dev/neofs-contract

Repository files navigation

NeoFS

NeoFS related smart contracts.


Overview

NeoFS-Contract contains all NeoFS related contracts written for neo-go compiler. These contracts are deployed both in the mainchain and the sidechain.

Mainchain contracts:

  • neofs
  • processing

Sidechain contracts:

  • alphabet
  • audit
  • balance
  • container
  • neofsid
  • netmap
  • nns
  • proxy
  • reputation

Getting started

Prerequisites

To compile smart contracts you need:

Compilation

To build and compile smart contract, run make all command. Compiled contracts *_contract.nef and manifest config.json files are placed in the corresponding directories. Generated RPC binding files rpcbinding.go are placed in the corresponding rpc directories.

$ make all
/home/user/go/bin/cli contract compile -i alphabet -c alphabet/config.yml -m alphabet/config.json -o alphabet/alphabet_contract.nef --bindings alphabet/bindings_config.yml
mkdir -p rpc/alphabet
/home/user/go/bin/cli contract generate-rpcwrapper -o rpc/alphabet/rpcbinding.go -m alphabet/config.json --config alphabet/bindings_config.yml
...

You can specify path to the neo-go binary with NEOGO environment variable:

$ NEOGO=/home/user/neo-go/bin/neo-go make all

Remove compiled files with make clean command.

Building Debian package

To build Debian package containing compiled contracts, run make debpackage command. Package will install compiled contracts *_contract.nef and manifest config.json with corresponding directories to /var/lib/neofs/contract for further usage. It will download and build neo-go, if needed.

To clean package-related files, use make debclean.

Testing

Smartcontract tests reside in tests/ directory. To execute test suite after applying changes, simply run make test.

$ make test
ok      github.com/nspcc-dev/neofs-contract/tests       0.462s

NeoFS API compatibility

neofs-contract version supported NeoFS API versions
v0.9.x v2.7.0, v2.8.0
v0.10.x v2.7.0, v2.8.0
v0.11.x v2.7.0, v2.8.0, v2.9.0
v0.12.x v2.10.0
v0.13.x v2.11.0
v0.14.x v2.11.0
v0.15.x v2.11.0, v2.12.0
v0.15.x v2.11.0, v2.12.0
v0.16.x v2.14.0

License

Contracts are licensed under the GPLv3 license, bindings and other integration code is provided under the Apache 2.0 license - see LICENSE.md for details.