Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ An npm package for seamless integration of all NFT related functionalities in We
- `/src/index.ts ` : Toolbox class, the single default export from the package
- `/src/classes` : Core classes of the package that implement functionalities
- `/src/helpers` : Helper classes that are used by core classes
- `src/chains` : Blockchain-specific implementations, adapters, and example scripts for various functionalities
- `/tests` : Tests for all core classes
- `/examples` : Example scripts for all functionalities
- `/docs` : Markdown documentation
- `/documentation` : Docusaurus project for documentation website

Expand Down Expand Up @@ -64,7 +64,7 @@ An npm package for seamless integration of all NFT related functionalities in We
To run an example script, update the required credentials in `examples/*.json` file and run

```
ts-node examples/generate.ts
ts-node src/chains/Ethereum/functions/generateEthereum.ts
```

To run Tests, update the required credentials in `tests/test_specs.json` file and run
Expand Down
93 changes: 71 additions & 22 deletions documentation/docs/Contracts/draft.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ The **ERC721** and **ERC1155** standards created by [Open Zeppelin](https://www.
are the most popular NFT Contracts used by the community.
The [Open Zeppelin Wizard](https://wizard.openzeppelin.com/) is a tool that programatically generates
Smart Contracts based on provided configurations.

In addition to this, NFT-Toolbox also supports the **ERC998** and **ERC1151** standards. However, these standards are not currently supported by Open Zeppelin.

To accommodate this, we have custom implementations of ERC998 and ERC1151. The custom implementation of ERC998 is based on the reference implementation provided by [Matt Lockyer's](https://github.com/mattlockyer/composables-998) GitHub repository.

NFT Toolbox provides the `draftContract` function that acts as an interface to Open Zeppelin Wizard.
Thus enabling users to generate Solidity Smart Contracts specifically to be used in their NFT projects.


## Parameters

:::info
Expand All @@ -20,26 +26,38 @@ See the platform to test the generated contract before using them in NFT Toolbox

The parameters of `initContract` function are described as follows.

| Name | Type | Standard Supported | Description |
| -------------- | ------- | ---------------------- | ------------------------------------------ |
| `baseUri` | string | `ERC721` and `ERC1155` | Base URI used in deployment |
| `burnable` | boolean | `ERC721` and `ERC1155` | Allow Tokens to be Burned |
| `pausable` | boolean | `ERC721` and `ERC1155` | Allow Transactions to be Paused |
| `mintable` | boolean | `ERC721` and `ERC1155` | Allow minting of new tokens |
| `enumerable` | boolean | `ERC721` | Allow enumerating the tokens on chain |
| `uriStorage` | boolean | `ERC721` | Include Storage based URI management |
| `incremental` | boolean | `ERC721` | Assign incremental id to new Tokens |
| `votes` | boolean | `ERC721` | Include support for voting and delegation |
| `supply` | boolean | `ERC1155` | Track Total Supply |
| `updatableUri` | boolean | `ERC1155` | Allow Privileged accounts to set a new URI |
| Name | Type | Standard Supported | Description |
| -------------- | ------- | -------------------------------------------| ------------------------------------------ |
| `baseUri` | string | `ERC721`,`ERC1155`,`ERC998`and `ERC1151` | Base URI used in deployment |
| `burnable` | boolean | `ERC721`,`ERC1155`,`ERC998`and `ERC1151` | Allow Tokens to be Burned |
| `pausable` | boolean | `ERC721`,`ERC1155`,`ERC998`and `ERC1151` | Allow Transactions to be Paused |
| `mintable` | boolean | `ERC721`,`ERC1155`,`ERC998`and `ERC1151` | Allow minting of new tokens |
| `enumerable` | boolean | `ERC721` | Allow enumerating the tokens on chain |
| `uriStorage` | boolean | `ERC721` | Include Storage based URI management |
| `incremental` | boolean | `ERC721` | Assign incremental id to new Tokens |
| `votes` | boolean | `ERC721` | Include support for voting and delegation |
| `composable` | boolean | `ERC998` | Enable composability of tokens |
| `rootOwner` | address | `ERC998` | Address of the root owner |
| `rootId` | uint256 | `ERC998` | Root ID for the composable tokens |
| `extension` | address | `ERC998` | Address of the ERC998 extension contract |
| `extensionId` | uint256 | `ERC998` | Extension ID for the composable tokens |
| `nftOwners` | mapping | `ERC1151` | Mapping for NFT owners |
| `ownerToNFTCount` | mapping | `ERC1151` | Mapping for owner NFT count |
| `nftApprovals` | mapping | `ERC1151` | Mapping for NFT approvals |
| `nftBalances` | mapping | `ERC1151` | Mapping for NFT balances |
| `nftData` | mapping | `ERC1151` | Mapping for NFT data |
| `operatorApprovals`| mapping | `ERC1151` | Mapping for operator approvals |
| `supply` | boolean | `ERC1155` | Track Total Supply |
| `updatableUri` | boolean | `ERC1155` | Allow Privileged accounts to set a new URI |


## Examples

**After [Initializing the Contract Object](/docs/Contracts/initializeContract),**

Pass the required configurations to `draftContract` function to create a Solidity File.

- **Standard: ERC271**
- **Standard: ERC721**

```javascript
nftToolbox.draftContract({
Expand All @@ -53,12 +71,48 @@ nftToolbox.draftContract({
uriStorage: false
incremental: false
votes: false
// ERC1155 options
supply: false;
updatableUri: false;
});
```



- **Standard: ERC998**

```javascript
nftToolbox.draftContract({
baseUri: "ipfs://exampleCID/",
// Common options
burnable: false,
pausable: false,
mintable: false,
// ERC998 options
composable: true,
rootOwner: "0x0000000000000000000000000000000000000000", // Address of the root owner
rootId: 1, // Root ID for the composable tokens
extension: "0x0000000000000000000000000000000000000000", // Address of the ERC998 extension contract
extensionId: 1, // Extension ID for the composable tokens
});
```

- **Standard: ERC1151**


```javascript
nftToolbox.draftContract({
baseUri: "ipfs://exampleCID/",
// Common options
burnable: false,
pausable: false,
mintable: false,
// ERC1151 options
nftOwners: {}, // Mapping for NFT owners
ownerToNFTCount: {}, // Mapping for owner NFT count
nftApprovals: {}, // Mapping for NFT approvals
nftBalances: {}, // Mapping for NFT balances
nftData: {}, // Mapping for NFT data
operatorApprovals: {}, // Mapping for operator approvals
});
```
- **Standard: ERC1155**

```javascript
Expand All @@ -68,13 +122,8 @@ nftToolbox.draftContract({
burnable: false
pausable: false
mintable: false
// ERC721 options
enumerable: false
uriStorage: false
incremental: false
votes: false
// ERC1155 options
supply: false;
updatableUri: false;
});
```
```
5 changes: 1 addition & 4 deletions documentation/docs/Contracts/initializeContract.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The parameters of `initContract` function are described as follows.
| `name` | string | Name of the Contract used on deployment |
| `symbol` | string | Symbol of the Contract used on deployment |
| `dir` | string | Path to directory where the new Contract File is to be created |
| `standard` | string | `"ERC721"` or `"ERC1155"` |
| `standard` | string | `"ERC721"` `"ERC998"` `"ERC1151"` or `"ERC1155"` |
| `connection` | object | Used to set up **ethers.js** connection. Described [here](/docs/Contracts/initializeContract#connection-details) |
| `deployed` | object | _(optional)_ Used for initialization of deployed contracts. Described [here](/docs/Contracts/initializeContract#initialization-for-deployed-contract) |

Expand All @@ -39,10 +39,7 @@ See their [documentation](https://docs.ethers.io/v5/) for more details.
#### Supported Networks

- Ethereum Mainnet (`"homestead"`)
- Ropsten Testnet (`"ropsten"`)
- Rinkeby Testnet (`"rinkeby"`)
- Goerli Testnet (`"goerli"`)
- Kovan Testnet (`"kovan"`)
- Polygon Mainnet (`"matic"`)
- Polygon Mumbai Testnet (`"maticmum"`)

Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The following functionalities are currently supported :

## Workflows

![Project Workflows](/workflows.png)
![Project Workflows](../static/img/workflows.png)

## Installation and Usage

Expand Down
Loading