neofs-contract

module
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2025 License: GPL-3.0, Apache-2.0

README

NeoFS

NeoFS related smart contracts.


codecov GithubWorkflows Tests Report GitHub release (latest SemVer) License

Overview

neofs-contract contains all NeoFS-related contracts written for neo-go compiler. There are contracts both for the main and FS chains.

Main chain (mainnet) contracts:

  • neofs
  • processing

FS chain contracts:

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

Getting started

Compilation

To build and compile smart contract, run make all command. Compiled contracts contract.nef and manifest manifest.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 contracts/alphabet -c contracts/alphabet/config.yml -m contracts/alphabet/manifest.json -o contracts/alphabet/contract.nef --bindings contracts/alphabet/bindings_config.yml
mkdir -p rpc/alphabet
/home/user/go/bin/cli contract generate-rpcwrapper -o rpc/alphabet/rpcbinding.go -m contracts/alphabet/manifest.json --config contracts/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 manifest.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

Comparing contracts content of NeoFS chains

scripts directory contains CLI utilities to compare some of the NeoFS contract contents between two RPC nodes:

  • compare-fscontent performs comparison of container blobs and NetMap contract entries.
  • compare-deposits performs comparison of mainnet deposits and FS chain balance mints.

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.

Directories

Path Synopsis
cmd
Package contracts embeds compiled NeoFS contracts and provides access to them.
Package contracts embeds compiled NeoFS contracts and provides access to them.
alphabet
Package alphabet implements Alphabet contract which is deployed to FS chain.
Package alphabet implements Alphabet contract which is deployed to FS chain.
audit
Package audit implements Audit contract which is deployed to FS chain.
Package audit implements Audit contract which is deployed to FS chain.
balance
Package balance implements Balance contract which is deployed to FS chain.
Package balance implements Balance contract which is deployed to FS chain.
container
Package container implements Container contract which is deployed to FS chain.
Package container implements Container contract which is deployed to FS chain.
neofs
Package neofs contains NeoFS contract which is deployed to main chain.
Package neofs contains NeoFS contract which is deployed to main chain.
neofsid
Package neofsid contains NeoFSID contract which is deployed to FS chain.
Package neofsid contains NeoFSID contract which is deployed to FS chain.
netmap
Package netmap contains implementation of the Netmap contract for NeoFS systems.
Package netmap contains implementation of the Netmap contract for NeoFS systems.
nns
Package nns contains non-divisible non-fungible NEP11-compatible token implementation.
Package nns contains non-divisible non-fungible NEP11-compatible token implementation.
processing
Package processing contains Processing contract which is deployed to main chain.
Package processing contains Processing contract which is deployed to main chain.
proxy
Package proxy implements Proxy contract which is deployed to FS chain.
Package proxy implements Proxy contract which is deployed to FS chain.
reputation
Package reputation implements Reputation contract which is deployed to FS chain.
Package reputation implements Reputation contract which is deployed to FS chain.
rpc
alphabet
Package alphabet contains RPC wrappers for NeoFS Alphabet contract.
Package alphabet contains RPC wrappers for NeoFS Alphabet contract.
audit
Package audit contains RPC wrappers for NeoFS Audit contract.
Package audit contains RPC wrappers for NeoFS Audit contract.
balance
Package balance contains RPC wrappers for NeoFS Balance contract.
Package balance contains RPC wrappers for NeoFS Balance contract.
container
Package container contains RPC wrappers for NeoFS Container contract.
Package container contains RPC wrappers for NeoFS Container contract.
neofs
Package neofs contains RPC wrappers for NeoFS contract.
Package neofs contains RPC wrappers for NeoFS contract.
neofsid
Package neofsid contains RPC wrappers for NeoFS ID contract.
Package neofsid contains RPC wrappers for NeoFS ID contract.
netmap
Package netmap contains RPC wrappers for NeoFS Netmap contract.
Package netmap contains RPC wrappers for NeoFS Netmap contract.
nns
Package nns contains RPC wrappers for NameService contract.
Package nns contains RPC wrappers for NameService contract.
processing
Package processing contains RPC wrappers for NeoFS Multi Signature Processing contract.
Package processing contains RPC wrappers for NeoFS Multi Signature Processing contract.
proxy
Package proxy contains RPC wrappers for NeoFS Notary Proxy contract.
Package proxy contains RPC wrappers for NeoFS Notary Proxy contract.
reputation
Package reputation contains RPC wrappers for NeoFS Reputation contract.
Package reputation contains RPC wrappers for NeoFS Reputation contract.
scripts
dump
Package dump provides I/O operations for collected states of the Neo smart contracts.
Package dump provides I/O operations for collected states of the Neo smart contracts.
migration
Package migration provides framework to test migration of the NeoFS smart contracts.
Package migration provides framework to test migration of the NeoFS smart contracts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL