2020-10-27 12:41:47 +00:00
|
|
|
<p align="center">
|
2024-11-06 09:37:22 +00:00
|
|
|
<img src="./.forgejo/logo.svg" width="500px" alt="FrostFS">
|
2020-10-27 12:41:47 +00:00
|
|
|
</p>
|
|
|
|
<p align="center">
|
2023-01-09 08:33:45 +00:00
|
|
|
<a href="https://frostfs.info">FrostFS</a> related smart contracts.
|
2020-10-27 12:41:47 +00:00
|
|
|
</p>
|
2020-03-30 13:59:54 +00:00
|
|
|
|
2020-10-27 12:41:47 +00:00
|
|
|
---
|
2020-03-30 13:59:54 +00:00
|
|
|
|
2020-10-27 12:41:47 +00:00
|
|
|
# Overview
|
2020-03-30 13:59:54 +00:00
|
|
|
|
2023-01-09 08:33:45 +00:00
|
|
|
FrostFS-Contract contains all FrostFS related contracts written for
|
2020-10-27 12:41:47 +00:00
|
|
|
[neo-go](https://github.com/nspcc-dev/neo-go) compiler. These contracts
|
2022-04-14 11:56:51 +00:00
|
|
|
are deployed both in the mainchain and the sidechain.
|
2020-03-30 13:59:54 +00:00
|
|
|
|
2022-04-14 11:56:51 +00:00
|
|
|
Mainchain contracts:
|
2020-03-30 13:59:54 +00:00
|
|
|
|
2023-01-11 07:52:06 +00:00
|
|
|
- frostfs
|
2021-04-21 06:44:44 +00:00
|
|
|
- processing
|
2020-03-30 13:59:54 +00:00
|
|
|
|
2022-04-14 11:56:51 +00:00
|
|
|
Sidechain contracts:
|
2020-03-30 13:59:54 +00:00
|
|
|
|
2020-12-29 11:32:37 +00:00
|
|
|
- alphabet
|
2020-10-27 12:41:47 +00:00
|
|
|
- audit
|
|
|
|
- balance
|
|
|
|
- container
|
2023-01-11 07:52:06 +00:00
|
|
|
- frostfsid
|
2020-10-27 12:41:47 +00:00
|
|
|
- netmap
|
2021-07-22 17:54:54 +00:00
|
|
|
- nns
|
2021-03-22 06:18:33 +00:00
|
|
|
- proxy
|
2020-10-27 12:41:47 +00:00
|
|
|
- reputation
|
|
|
|
|
|
|
|
# Getting started
|
|
|
|
|
|
|
|
## Prerequisites
|
|
|
|
|
|
|
|
To compile smart contracts you need:
|
|
|
|
|
2022-10-17 15:35:00 +00:00
|
|
|
- [neo-go](https://github.com/nspcc-dev/neo-go) >= 0.99.2
|
2020-10-27 12:41:47 +00:00
|
|
|
|
|
|
|
## Compilation
|
|
|
|
|
2022-04-14 11:56:51 +00:00
|
|
|
To build and compile smart contract, run `make all` command. Compiled contracts
|
2020-10-27 12:41:47 +00:00
|
|
|
`*_contract.nef` and manifest `config.json` files are placed in the
|
|
|
|
corresponding directories.
|
2020-03-30 13:59:54 +00:00
|
|
|
|
|
|
|
```
|
2020-10-27 12:41:47 +00:00
|
|
|
$ make all
|
2021-12-07 12:06:43 +00:00
|
|
|
/home/user/go/bin/cli contract compile -i alphabet -c alphabet/config.yml -m alphabet/config.json -o alphabet/alphabet_contract.nef
|
|
|
|
/home/user/go/bin/cli contract compile -i audit -c audit/config.yml -m audit/config.json -o audit/audit_contract.nef
|
|
|
|
/home/user/go/bin/cli contract compile -i balance -c balance/config.yml -m balance/config.json -o balance/balance_contract.nef
|
|
|
|
/home/user/go/bin/cli contract compile -i container -c container/config.yml -m container/config.json -o container/container_contract.nef
|
2023-01-11 07:52:06 +00:00
|
|
|
/home/user/go/bin/cli contract compile -i frostfsid -c frostfsid/config.yml -m frostfsid/config.json -o frostfsid/frostfsid_contract.nef
|
2021-12-07 12:06:43 +00:00
|
|
|
/home/user/go/bin/cli contract compile -i netmap -c netmap/config.yml -m netmap/config.json -o netmap/netmap_contract.nef
|
|
|
|
/home/user/go/bin/cli contract compile -i proxy -c proxy/config.yml -m proxy/config.json -o proxy/proxy_contract.nef
|
|
|
|
/home/user/go/bin/cli contract compile -i reputation -c reputation/config.yml -m reputation/config.json -o reputation/reputation_contract.nef
|
|
|
|
/home/user/go/bin/cli contract compile -i nns -c nns/config.yml -m nns/config.json -o nns/nns_contract.nef
|
2023-01-11 07:52:06 +00:00
|
|
|
/home/user/go/bin/cli contract compile -i frostfs -c frostfs/config.yml -m frostfs/config.json -o frostfs/frostfs_contract.nef
|
2021-12-07 12:06:43 +00:00
|
|
|
/home/user/go/bin/cli contract compile -i processing -c processing/config.yml -m processing/config.json -o processing/processing_contract.nef
|
2020-03-30 13:59:54 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
You can specify path to the `neo-go` binary with `NEOGO` environment variable:
|
|
|
|
|
|
|
|
```
|
2020-10-27 12:41:47 +00:00
|
|
|
$ NEOGO=/home/user/neo-go/bin/neo-go make all
|
2020-03-30 13:59:54 +00:00
|
|
|
```
|
|
|
|
|
2020-12-29 11:32:37 +00:00
|
|
|
Remove compiled files with `make clean` or `make mr_proper` command.
|
2020-10-27 12:41:47 +00:00
|
|
|
|
2022-10-31 15:48:26 +00:00
|
|
|
## 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`.
|
|
|
|
|
2021-10-04 12:08:37 +00:00
|
|
|
# Testing
|
|
|
|
Smartcontract tests reside in `tests/` directory. To execute test suite
|
2022-04-14 11:56:51 +00:00
|
|
|
after applying changes, simply run `make test`.
|
2021-10-04 12:08:37 +00:00
|
|
|
```
|
|
|
|
$ make test
|
2023-03-07 11:06:21 +00:00
|
|
|
ok git.frostfs.info/TrueCloudLab/frostfs-contract/tests 0.462s
|
2021-10-04 12:08:37 +00:00
|
|
|
```
|
|
|
|
|
2020-10-27 12:41:47 +00:00
|
|
|
# License
|
2020-03-30 13:59:54 +00:00
|
|
|
|
|
|
|
This project is licensed under the GPLv3 License - see the
|
|
|
|
[LICENSE.md](LICENSE.md) file for details
|