---
# System prepended metadata

title: NFT

---

[TOC]
# NFT

## [Truffle](https://www.trufflesuite.com/docs/truffle/overview)
- 起手式
```
npm install -g truffle
```
```
truffle unbox react
```
- 開發者模式(後端)
```
truffle develop
migrate
```
- React(前端)
```
npm start
```
- MetaMask 切換到 Localhost 8545
- [Truffle 指定 Solidity 版本](https://www.trufflesuite.com/docs/truffle/reference/configuration)
    - 搜尋 Solc 

## Erc20 Smart Contract
- [Add In The ERC20 Smart Contracts From OpenZeppelin ](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/v3.0.0-beta.0/contracts)
```
npm install @openzeppelin/contracts
```
```
truffle develop
migrate
```

## [Unit Test](https://www.trufflesuite.com/docs/truffle/testing/writing-tests-in-javascript)

### Chai
- install
```
npm install --save chai chai-bn chai-as-promised
```

- test/MyToken.test.js
```javascript
const Token = artifacts.require("MyToken");

var chai = require("chai");
const BN = web3.utils.BN;
const chaiBN = require("chai-bn")(BN);
chai.use(chaiBN);

var  chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);

const expect = chai.expect;

contract("Token Test", async (accounts) => {

})
```

