Implementation of the FA2 token contract (TZIP-12) for a NFT asset.
Instead of the off-chain view stored in the contract metadata as required
by the TZIP-12/TZIP-16 standards, this implementation provides access to token
metadata through on-chain %token_metadata
view entry point.
ligo
- contracts code defined in LIGO, smart-contract language for Tezos.ligo/fa2
- FA2 contract interfaces and librariesligo/fa2_modules
- reusable contract implementation modulesligo/fa2_clients
- test client contracts interacting with FA2 contractligo/src
folder - reference implementation of the multi-asset FA2 contract, test helper contracts and code.ligo/out
folder - multi-asset FA2 contract and helper contract compiled into Michelson.
tezos_fa2_nft_tests
folder - Python NFT asset FA2 contract tests implemented with Pytezos and unittest.
If you are running the tests, the correct LIGO docker image version will be downloaded automatically when used first time.
See LIGO installation instructions for more details or alternative installation options.
To run the test, Python 3.6+ and pip 19.0.1+ are required.
Pytezos can be installed as tezos_fa2_nft_tests
module dependency, but it requires
to install several cryptographic packages first.
See Pytezos requirements.
Use apt or your favorite package manager:
sudo apt install libsodium-dev libsecp256k1-dev libgmp-dev
Use homebrew:
brew tap cuber/homebrew-libsecp256k1
brew install libsodium libsecp256k1 gmp
Tests are configured to run on Flextesa sandbox.
There are two helper scripts in tezos_fa2_nft_tests
module:
start-sandbox.sh
- starts Flextesa sandbox from the docker imagekill-sandbox.sh
- kills running Flextesa sandbox docker container
brew tap cuber/homebrew-libsecp256k1
brew install libsodium libsecp256k1 gmp
python3 -m venv tezos_fa2_nft_tests
source tezos_fa2_nft_tests/bin/activate
git clone https://github.com/tqtezos/smart-contracts.git
cd smart-contracts/nft_asset
pip install -e .
Alternatively, you can install it directly from Github:
pip3 install -e "git+https://github.com/tqtezos/smart-contracts.git#subdirectory=nft_asset&egg=tezos_fa2_nft_tests"
It will install Pytezos dependencies as well.
./flextesa/start-sandbox.sh
When running for the first time, it will download sandbox docker image. It may take a few seconds until sandbox is bootstrapped.
python -m unittest discover tezos_fa2_nft_tests