Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

Commit 668f05c

Browse files
authored
WIP: Modular contract documentation [DO NOT MERGE] (#528)
* Initial implementation of modular contract documentation - Implemented overview, how it works, get started docs - Updated sidebar to reflect the new naming and links * created the documents for the directory of core-contracts * created file structure for extension contracts * created documentation for extension contracts * updated sidebar to reflect the new changes * fix: correctly implemments the right icon for modular contracts
1 parent 1e76340 commit 668f05c

File tree

130 files changed

+1515
-582
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+1515
-582
lines changed

bun.lockb

436 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"escape-string-regexp": "^5.0.0",
2727
"flexsearch": "^0.7.43",
2828
"github-slugger": "^2.0.0",
29-
"lucide-react": "^0.286.0",
29+
"lucide-react": "^0.416.0",
3030
"next": "^14.2.3",
3131
"nextjs-toploader": "^1.6.12",
3232
"node-html-parser": "^6.1.13",

pnpm-lock.yaml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/contracts/build/get-started/page.mdx

Lines changed: 0 additions & 186 deletions
This file was deleted.

src/app/contracts/build/overview/page.mdx

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { createMetadata } from "@doc";
2+
3+
export const metadata = createMetadata({
4+
title: "thirdweb Modular Contracts",
5+
description:
6+
"Modular Contract provides a framework to build custom smart contracts more efficiently by offering a set of pre-built base contracts and reusable components, better known as extensions.",
7+
image: {
8+
title: "thirdweb Modular Contracts",
9+
icon: "solidity",
10+
},
11+
});
12+
13+
# ERC-1155 Core
14+
15+
## Supported Callback Functions
16+
17+
| Function | Mode |
18+
|----------------------|-------------|
19+
| `beforeMintERC1155` | REQUIRED |
20+
| `beforeTransferERC1155` | OPTIONAL |
21+
| `beforeBatchTransferERC1155` | OPTIONAL |
22+
| `beforeBurnERC1155` | OPTIONAL |
23+
| `beforeApproveForAll`| OPTIONAL |
24+
| `onTokenURI` | REQUIRED |
25+
| `beforeBatchMintERC1155` | REQUIRED |
26+
27+
## Supported Interfaces
28+
29+
| Interface | ID |
30+
|------------------|-------------|
31+
| `ERC165` | `0x01ffc9a7`|
32+
| `ERC1155` | `0xd9b67a26`|
33+
| `ERC1155MetadataURI` | `0x0e89341c`|
34+
| `ERC-7572` | `0xe8a3d485`|
35+
| `ERC-173` | `0x7f5828d0`|
36+
37+
## Functions Supported
38+
39+
| Function | Description |
40+
|-------------------------|-----------------------------------------------------------------------------|
41+
| `constructor` | Initializes the contract with parameters for name, symbol, metadata URI, owner, extensions, and extension data. |
42+
| `name` | Returns the name of the NFT Collection. |
43+
| `symbol` | Returns the symbol of the NFT Collection. |
44+
| `contractURI` | Returns the contract metadata URI. |
45+
| `totalSupply` | Returns the total supply of a tokenId of the NFT collection. |
46+
| `uri` | Returns the token metadata of an NFT. |
47+
| `supportsInterface` | Checks if the contract implements an interface with the given interface ID. |
48+
| `getSupportedCallbackFunctions` | Returns the supported callback functions. |
49+
| `setContractURI` | Sets the contract metadata URI. Callable only by the contract admin. |
50+
| `mint` | Mints tokens with a given tokenId to a specified address, calling the beforeMint hook. |
51+
| `batchMint` | Batch mints tokens to a specified address, calling the beforeBatchMint hook. |
52+
| `burn` | Burns a specified amount of tokens, calling the beforeBurn hook if it exists.|
53+
| `safeTransferFrom` | Transfers ownership of an NFT, calling the beforeTransfer hook if it exists.|
54+
| `safeBatchTransferFrom` | Batch transfers ownership of NFTs, calling the beforeBatchTransfer hook if it exists. |
55+
| `setApprovalForAll` | Approves or revokes approval from an operator to transfer all NFTs. Calls the beforeApproveForAll hook if it exists. |
56+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { createMetadata } from "@doc";
2+
3+
export const metadata = createMetadata({
4+
title: "thirdweb Modular Contracts",
5+
description:
6+
"Modular Contract provides a framework to build custom smart contracts more efficiently by offering a set of pre-built base contracts and reusable components, better known as extensions.",
7+
image: {
8+
title: "thirdweb Modular Contracts",
9+
icon: "solidity",
10+
},
11+
});
12+
13+
# ERC-20 Core
14+
15+
## Supported Callback Functions
16+
17+
| Function | Mode |
18+
|----------------------|------------|
19+
| `beforeMintERC20` | REQUIRED |
20+
| `beforeTransferERC20`| OPTIONAL |
21+
| `beforeBurnERC20` | OPTIONAL |
22+
| `beforeApproveERC20` | OPTIONAL |
23+
24+
## Supported Interfaces
25+
26+
| Interface | ID |
27+
|-----------------|-------------|
28+
| `ERC165` | `0x01ffc9a7`|
29+
| `ERC-7572` | `0xe8a3d485`|
30+
| `ERC-173` | `0x7f5828d0`|
31+
| `ERC20` | `0x36372b07`|
32+
33+
## Functions Supported
34+
35+
| Function | Description |
36+
|-------------------------|-----------------------------------------------------------------------------|
37+
| `constructor` | Initializes the contract with parameters for name, symbol, metadata URI, owner, extensions, and extension data. |
38+
| `name` | Returns the name of the token. |
39+
| `symbol` | Returns the symbol of the token. |
40+
| `contractURI` | Returns the contract metadata URI. |
41+
| `getSupportedCallbackFunctions` | Returns the supported callback functions. |
42+
| `supportsInterface` | Checks if the contract implements an interface with the given interface ID. |
43+
| `setContractURI` | Sets the contract metadata URI. Callable only by the contract admin. |
44+
| `mint` | Mints tokens to a specified address, calling the beforeMint hook. |
45+
| `burn` | Burns a specified amount of tokens, calling the beforeBurn hook if it exists.|
46+
| `transfer` | Transfers tokens to a specified address, calling the beforeTransfer hook if it exists. |
47+
| `transferFrom` | Transfers tokens from one address to another, calling the beforeTransfer hook if it exists. |
48+
| `approve` | Approves a spender to spend tokens on behalf of an owner, calling the beforeApprove hook if it exists. |
49+
| `permit` | Sets allowance based on token owner's signed approval, calling the beforeApprove hook if it exists. |
50+

0 commit comments

Comments
 (0)