This repository has been archived by the owner on Aug 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
130 changed files
with
1,515 additions
and
582 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
56 changes: 56 additions & 0 deletions
56
src/app/contracts/modular-contracts/core-contracts/erc-1155/page.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { createMetadata } from "@doc"; | ||
|
||
export const metadata = createMetadata({ | ||
title: "thirdweb Modular Contracts", | ||
description: | ||
"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.", | ||
image: { | ||
title: "thirdweb Modular Contracts", | ||
icon: "solidity", | ||
}, | ||
}); | ||
|
||
# ERC-1155 Core | ||
|
||
## Supported Callback Functions | ||
|
||
| Function | Mode | | ||
|----------------------|-------------| | ||
| `beforeMintERC1155` | REQUIRED | | ||
| `beforeTransferERC1155` | OPTIONAL | | ||
| `beforeBatchTransferERC1155` | OPTIONAL | | ||
| `beforeBurnERC1155` | OPTIONAL | | ||
| `beforeApproveForAll`| OPTIONAL | | ||
| `onTokenURI` | REQUIRED | | ||
| `beforeBatchMintERC1155` | REQUIRED | | ||
|
||
## Supported Interfaces | ||
|
||
| Interface | ID | | ||
|------------------|-------------| | ||
| `ERC165` | `0x01ffc9a7`| | ||
| `ERC1155` | `0xd9b67a26`| | ||
| `ERC1155MetadataURI` | `0x0e89341c`| | ||
| `ERC-7572` | `0xe8a3d485`| | ||
| `ERC-173` | `0x7f5828d0`| | ||
|
||
## Functions Supported | ||
|
||
| Function | Description | | ||
|-------------------------|-----------------------------------------------------------------------------| | ||
| `constructor` | Initializes the contract with parameters for name, symbol, metadata URI, owner, extensions, and extension data. | | ||
| `name` | Returns the name of the NFT Collection. | | ||
| `symbol` | Returns the symbol of the NFT Collection. | | ||
| `contractURI` | Returns the contract metadata URI. | | ||
| `totalSupply` | Returns the total supply of a tokenId of the NFT collection. | | ||
| `uri` | Returns the token metadata of an NFT. | | ||
| `supportsInterface` | Checks if the contract implements an interface with the given interface ID. | | ||
| `getSupportedCallbackFunctions` | Returns the supported callback functions. | | ||
| `setContractURI` | Sets the contract metadata URI. Callable only by the contract admin. | | ||
| `mint` | Mints tokens with a given tokenId to a specified address, calling the beforeMint hook. | | ||
| `batchMint` | Batch mints tokens to a specified address, calling the beforeBatchMint hook. | | ||
| `burn` | Burns a specified amount of tokens, calling the beforeBurn hook if it exists.| | ||
| `safeTransferFrom` | Transfers ownership of an NFT, calling the beforeTransfer hook if it exists.| | ||
| `safeBatchTransferFrom` | Batch transfers ownership of NFTs, calling the beforeBatchTransfer hook if it exists. | | ||
| `setApprovalForAll` | Approves or revokes approval from an operator to transfer all NFTs. Calls the beforeApproveForAll hook if it exists. | | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
50 changes: 50 additions & 0 deletions
50
src/app/contracts/modular-contracts/core-contracts/erc-20/page.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { createMetadata } from "@doc"; | ||
|
||
export const metadata = createMetadata({ | ||
title: "thirdweb Modular Contracts", | ||
description: | ||
"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.", | ||
image: { | ||
title: "thirdweb Modular Contracts", | ||
icon: "solidity", | ||
}, | ||
}); | ||
|
||
# ERC-20 Core | ||
|
||
## Supported Callback Functions | ||
|
||
| Function | Mode | | ||
|----------------------|------------| | ||
| `beforeMintERC20` | REQUIRED | | ||
| `beforeTransferERC20`| OPTIONAL | | ||
| `beforeBurnERC20` | OPTIONAL | | ||
| `beforeApproveERC20` | OPTIONAL | | ||
|
||
## Supported Interfaces | ||
|
||
| Interface | ID | | ||
|-----------------|-------------| | ||
| `ERC165` | `0x01ffc9a7`| | ||
| `ERC-7572` | `0xe8a3d485`| | ||
| `ERC-173` | `0x7f5828d0`| | ||
| `ERC20` | `0x36372b07`| | ||
|
||
## Functions Supported | ||
|
||
| Function | Description | | ||
|-------------------------|-----------------------------------------------------------------------------| | ||
| `constructor` | Initializes the contract with parameters for name, symbol, metadata URI, owner, extensions, and extension data. | | ||
| `name` | Returns the name of the token. | | ||
| `symbol` | Returns the symbol of the token. | | ||
| `contractURI` | Returns the contract metadata URI. | | ||
| `getSupportedCallbackFunctions` | Returns the supported callback functions. | | ||
| `supportsInterface` | Checks if the contract implements an interface with the given interface ID. | | ||
| `setContractURI` | Sets the contract metadata URI. Callable only by the contract admin. | | ||
| `mint` | Mints tokens to a specified address, calling the beforeMint hook. | | ||
| `burn` | Burns a specified amount of tokens, calling the beforeBurn hook if it exists.| | ||
| `transfer` | Transfers tokens to a specified address, calling the beforeTransfer hook if it exists. | | ||
| `transferFrom` | Transfers tokens from one address to another, calling the beforeTransfer hook if it exists. | | ||
| `approve` | Approves a spender to spend tokens on behalf of an owner, calling the beforeApprove hook if it exists. | | ||
| `permit` | Sets allowance based on token owner's signed approval, calling the beforeApprove hook if it exists. | | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.