@ligo/fa
A FA2 contract with nft, single asset & multi asset contracts
Installation
ligo install @ligo/fa
Readme
LIGO-FA (tokens)
ligo-fa
is a collection of FA2 (TZIP-12)
implementations written in LIGO
It provides 3 types of asset contracts:
- NFT: This contract implements the FA2 interface for NFT(non-fungible-token) where a token can belong to only one address at a time (1:1)
- Single Asset./lib/fa2/asset/single_asset.mligo): This is an implementation of Single Asset Token where a different amount of single token can belong to multiple addresses at a time (1:n)
- Multi Asset: This is an implementation of Multi Asset Token where there are many tokens (available in different amounts) and they can belong to multiple addresses (m:n)
Development
To compile the contracts to Michelson , run
make compile
Tests
A makefile is provided to launch tests.
$ make test
The tests are available in ./test/fa2 directory, there is also an example of mutation testing
Deploy
A TypeScript program for deployment is provided to originate the smart contract. This deployment script relies on .env file which provides the RPC node url and the deployer public and private key. (example .env file)
$ make test
Usage
- To install this package, run
ligo install ligo-fa
. - In order originate the FA2 contracts from another contract you can use the
CREATE_CONTRACT
Michelcon instruction like this... let create_my_contract : lambda_create_contract = [%Michelson ( {| { UNPAIR ; UNPAIR ; CREATE_CONTRACT #include \"@ligo/fa/compiled/fa2/nft/NFT_mligo.tz\" ; PAIR } |})] in ...