This repository contain two contents:
-
Contracts of ZYJ DAO.
-
NodeJs sample of calling contracts.
If you only need the JS samples, you don't need to setup contracts. Fouce nodejs part is enough.
(1) Source code written by solidity under contracts/contracts folder;
(2) Migration scripts under contracts/migrations folder;
(3) Test code under contracts/test folder;
(4) Utils code under contracts/utils folder;
(5) Contracts address on each network saved under contracts/addresses folder;
(6) Compile output including ABI saved under contracts/build/contracts folder;
Copy .env.templete to .env and type in your Private key.
cd contracts
npm install
npm install -g truffle // If you haven't installed truffle yet.
To compile: truffle compile
--> it will generate compiled file under contracts/build/contracts folder.
To migrate to local dev network (like running ganache): npm run m:dev
To migrate to bsctest: npm run m:test
After migratation, contracts address will overwrite the old one in contracts/addresses folder.
(1) JS wrapper of ZNFT see node/samples/ZNFTWrapper.js;
(2) JS samples calling contracts under node/samples folder;
(3) Read config under node/config folder;
(4) Utils to get web3 under node/utils folder;
Copy config.json.templete to config.json under node/config folder and type in your Private key.
cd node
npm install
To create accounts: node samples/createAccounts
--> It will save created accounts under node/samples/savedAccounts.
The wrapper interfaces including mint, read total nft nums, read user balance, read all user tokens
To run tests of wrapper interfaces: node samples/ZNFTWrapper